a little function problem

genu

Well-known member
Joined
Jun 9, 2005
Messages
94
Programming Experience
1-3
ok I have 2 forms. On form1 they click a button which opens up form2, where they fill in a form and they click ok. When they click ok on form2, the program updates a textfile with added information. and on form1 I have to execute a function to refresh a listbox with the new information. So I basically need to find a way to execute a function when they click the ok button on form2. How access the function thats on form1 from form2?


I hop that makes sense.
 
If I'm correct in assuming that form2 closes when they click OK, you don't need to access the function from form2. In form1:
VB.NET:
Dim child As New Form2

'Set child properties as needed.
child.SomePublicProperty = SomeValue

If child.ShowDialog() = DialogResult.OK Then
	'Get child properties as needed.
	SomeValue = child.SomePublicProperty

	'Refresh form1 using a method you have written.
	Me.RefreshData()
End If
If form2 does not close then I think you should be using an Apply button instead of OK. There are several gazillion threads on this forum about inter-form communication that would apply in this case.
 
Back
Top