c# - Close Main Form -
i developing simple app using c# windows forms. main form open form, dont want both forms. want when second form opens first form closes. since first form main using
this.close();
after showing second form close both. used instead
private void btnsubmit_click(object sender, eventargs e) { frmdata qs = new frmdata(); qs.show(); this.windowstate = formwindowstate.minimized; this.showintaskbar = false; } private void frmdata_formclosed(object sender, formclosedeventargs e) { application.exit(); }
i want know if there other way this.
any appreciated.
do not pass main form argument application.run
:
application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); mainform frmmain = new mainform(); frmmain.show(); application.run();
thus able close when showing form:
private void btnsubmit_click(object sender, eventargs e) { frmdata qs = new frmdata(); qs.show(); this.close(); }
to close application should use
application.exit();
Comments
Post a Comment