winforms - which event of form1 is fired when form2 closes in vb.net -
i have 2 forms in project
when click on button on form1, form2 opens.
i have textboxes on form2.
when write text in textboxes have button save.
by clicking save button data saved database , form2 closes. form1 shown.
i have datagridview in form1. has data table in save data form2.
now problem when click on save button on form2 datagridview in form1 not have last record added.
this expected behavior because fill data in datagridview in form1.load event.
so event should use data in datagridview refreshed?
i have tried paint event of form1
not work.
i have tried form1.refresh()
in form2.closing
event.
i have tried gotfocus event of form1
crashes program unexpectedly.
i suggest if possible opening form using form2.showdialog
blocking call rather form2.show
.
when form 2 closes code continue on following line after showdialog
call allowing refresh thew list.
the alternative create own event:
1) define new event in form2 public event eventname()
2) use addhandler form2instance.eventname, addressof handlerfunctionname
in form 1 hook event
3) after save code in form2 use raiseevent eventname
trigger code
Comments
Post a Comment