Capturing Form Close Event

runswithsizzors

Well-known member
Joined
May 11, 2005
Messages
70
Location
Northern Michigan
Programming Experience
5-10
Capturing Form Close Event - Solve Thanks!

I have been working on creating a screen that deletes database records. On the main screen I have a delete button that opens the delete screen. I need to refresh the main screen when the delete screen is closed so the record in the datagrid is acurate and doesn't contain the deleted database record. What is the best way of doing this. This is the way I have been doing on the main form I have:

PrivateWithEvents DCForm As DCChild

PrivateSub DCForm_Close(ByVal sender AsObject, ByVal e As System.EventArgs) Handles DCForm.Closed

Me.ClearFields()
Me.DataGridRefresh()
EndSub

ClearFields and DataGridRefresh are two procedures I wrote to fresh the screen. But even if I put a messagebox or anything like that the function just isn't firing. Any suggestions?? Thanks!
 
Last edited:
use the ShowDialog method of the delete window then immediatly after the form is closed refresh the datagrid(s):

VB.NET:
Private DCForm as new DCChild

Private btnDelete_Click (...) Handles btnDelete.Click
  DCForm.ShowDialog()
  Call [size=2]ClearFields()[/size]
  Call DataGridRefresh()
End Sub
 
Back
Top