In your form2 declare a Class level variable of form type e.g.
Dim oForm as Form
now in the Load event of form2 just make this equal to the 'ActiveForm' property of 'Form1' e.g.
oForm = Form1.ActiveFormNow just enter the following code in the Button Click event handler or in whatever event you want to use in order to add items to the Listbox or whatever you want to do with the control on the form e.g.
Private Sub btnOK_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnOK.Click
CType(oForm, Form1).ListBox1.Items.Add(Me.TextBox1.Text)
'Like this you can now access any control on the Form
'Who's instance is already in memory.
End Sub
I hope this will help you !
No comments:
Post a Comment