c# - Hidden form not closing -
i have c# form
, have form1
shown @ start, , when press go
taken form2
. form1
hidden , form2
shown.
now when exit form2
, whole application should closed. using application.exit()
when press exit button. facing problems if user presses x or alt+f4 or rightclick->close
. form close hidden form stay opened.
how can fix that? when press 1 of these control button, hidden forms close?
i tried form1_close
, form1_closing
function didn't seem work.
try this:
hide(); form2 form2 = new form2(); form2.closed += (s, args) => this.close(); form2.show();
this close form1
when close form2
. if user presses x or alt+f4 or rightclick -> close
on form2
form2
, hidden form1
close.
Comments
Post a Comment