0

Pretty new to C# and I'm having a little trouble. I'm using WinForm and am supposed to, by the click of a button, close the window I'm currently on and refresh an already existing window/the content of the DataGrid it displays. How would one go to solve this?

I've been looking through this site and none of the suggested solutions were helpful to me.

Valkr1n
  • 1
  • 2
  • If the "already existing" window is the one that opened the other one you can subscribe to the closing or closed event and refresh your data during the event. – Crowcoder Apr 12 '18 at 11:51
  • Which part is giving you troubles (try to concentrate on one): 1) clicking the button 2) closing the window 3) refreshing another window 4) something else? – default locale Apr 12 '18 at 11:52
  • aren't you best just refreshing the Data Grid View, rather than the form itself, on the button click – Jack Henry Apr 12 '18 at 11:54
  • I can click the button, and the current window is closing. The problem I'm having is, how to update the window that I'm returning to. – Valkr1n Apr 12 '18 at 12:02
  • The window which you are closing, is that opening from the window you want to refresh ? as a child window? – Sabri Apr 12 '18 at 12:49
  • 1
    So, basically, you want to handle closing the current form. Check out this question, it should help: https://stackoverflow.com/questions/2395624/how-to-refresh-datagridview-when-closing-child-form – default locale Apr 12 '18 at 12:51

0 Answers0