Click here to Skip to main content
15,896,359 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two forms in my project. Mainform and dialog...

When I change somesetting on dialog and close, how i update main form?
Posted

There are a lot of ways that this can be done.

One way is to show the dialog modally and then when it's closed, check the changes in the dialog and update the main form.

If the form is open modelessly then you would want to use events. Have the dialog form raise events based on settings changing and then hook those events on the main form. Then, when the event is raised, implement the changes.
 
Share this answer
 
You could create a function in your dialog that displays the dialog (using it's ShowDialog method) and then returns a boolean to indicate whether the user updated the data or not. Then in your main form instead of calling the dialog's ShowDialog method call the function you created and refresh the grid if the function returns True.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900