Question : how can I refresh my datagridview without using a refresh button?

I have two forms one of them has a datagridview and the other is used to update the record the user clicks on the grid.  When the user closes the form use to update the record, the form closes and then the user needs to click on refresh before the updated record shows in the datagridview.
What event shoud I use to automate the refreshing of my data in a datagridview?.  Right now, I have the code in a refresh button in the form containing the datagridvie which works fine, but I would like the update of the datagridview to occur automatically when the user closes the form used to update the record.  The code is fine since it is updating the datagridview but  WHERE DO I PUT MY CODE SO I Can see the data in my datagridview change without having to click any buttons ?  Thank you,
Gloria

Answer : how can I refresh my datagridview without using a refresh button?

Change the following line:

frmDetail.Show()

To

frmDetail.ShowDialog()


When using frmDetail.Show(), the code after it will continue being executed after the form shows, while frmDetail.ShowDialog() shows a modal form, meaning the code after it will get executed only after the forms closes.

Random Solutions  
 
programming4us programming4us