dotnetmagic - reference controls between docked forms

  • Thread starter Thread starter Tom Erskine
  • Start date Start date
T

Tom Erskine

I have 2 docked forms using the dotnetmagic docking controls and I
need to have one the forms update a controls on the other. A simple
example would be FormA with a textbox and a button and FormB with a
listbox, both docked with dotnetmagic. When you click on
FormA.Button, it should add the text of FormA textbox to FormB
Listbox. I cannot figure out how to do this and I really need to.
Any help would be great!!

Thanks!
 
(e-mail address removed) (Tom Erskine) wrote in
I have 2 docked forms using the dotnetmagic docking controls and I
need to have one the forms update a controls on the other. A simple
example would be FormA with a textbox and a button and FormB with a
listbox, both docked with dotnetmagic. When you click on
FormA.Button, it should add the text of FormA textbox to FormB
Listbox. I cannot figure out how to do this and I really need to.
Any help would be great!!

Thanks!

In order for FormA to be able to change the data on a control in FormB,
FormA needs to have a reference to FormB.

Dim LocalFormBReference As FormB


'Some button on FormA causes FormB to be opened
Public Sub OpenFormBButton_Click(...)
LocalFormBReference = New FormB
FormB.Show
End Sub

'This is the button on FormA that updates the listbox on FormB
Public Sub UpdateFormBListBox_Click(...)
LocalFormBReference.ListBox.Items.Add(FormA.TextBox1.Text)
End Sub

Is this what you're looking for?

Chris
 
Thanks Chris. This is the approach that I was trying, however, the
docked forms in dotnetmagic are not called with a form.show. They are
instead called from within the control. I assume that I just need the
reference that the control is using, but I do not kow how to get it.
 
Back
Top