Form Closing Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, ther
I met a problem in my application. I have a starup modal winform, say, Form1, and a modal winform Form2. Form2 is displayed when user clicks a button on form1. My problem is I wish to take an action to refresh a control in Form1 right after Form2 is closed.
Can someone give any advice? Any code sample will be appreciated

Thanks a lot
 
Tracy,

If Form 2 is opened modally from Form 1, you can still access it until it is
disposed (the form is just hidden)

In Form2, set your 'OK' button DialogResult property = DialogResult.OK and
in the Form, set the AcceptButton property to the 'OK' button

Then, in Form 1
Dim frm as New Form2
If frm.ShowDialog = DialogResult.OK Then
'Set a property in Form1 (Me) based on a property in Form2 (frm). eg
Me.TextBox1.Text = frm.TextBox1.Text
End If
'Dispose Form2
frm.Dispose

Stephen


Tracey said:
Hi, there
I met a problem in my application. I have a starup modal winform, say,
Form1, and a modal winform Form2. Form2 is displayed when user clicks a
button on form1. My problem is I wish to take an action to refresh a control
in Form1 right after Form2 is closed.
 
Back
Top