I have two forms. Form A and Form B.
Form A has a datagrid that is populated from a SQL Database Table query. When a button is pressed Form B is launched that allows you to add a record to the database table. I need for the datagrid to be refreshed and show the newly added record when I close form B and go back to the parent.

I thought this would be easy, but it has been giving me fits.

I'm using a SQL Query to populate the DataGridView control, but I need to Requery the table again to repopulate it I think.

Can anyone give me any suggestions on how to do this?

I was looking for a way to re-fire the form load event but I can't figure out how.

Any help would be appreciated,

Thanks in advance,

You shouldnt call the Load event at all to be honest. Calling the load event at runtime will have sometimes very bad side effects.
Put your code for filling the datagrid in a seperate function and call this function in the load event of FormA and from FormB u call it FormA.myFunction

Thank you so much for this post. After creating a custom function to populate the datagridview control it was very easy for me to fire it from outside the form.

Thanks So Much!!!

This question has already been answered. Start a new discussion instead.