vb.net - How can I use the .Show() method in such a way the user can't click other forms already opened in background? -
now i'm using a'jobdone' flag , following behaviour (that looks quite horrible me...):
dim newloginform new loginclass loginclass.jobdone = false newloginform.show() while (loginclass.jobdone = false) application.doevents() end while newloginform.close() if try use showdialog() behaviour better it's problem manage opening , closing windows (if forms many) , notice background opened forms close either if 1 showdialog() form closed...
thanks
ran quick test , worked perfectly:
public sub forceopen(byref frm form) frm.show() each otherform form in application.openforms if otherform frm addhandler frm.formclosing, addressof blockformclosing else otherform.enabled = false end if next end sub public sub blockformclosing(byval sender system.object, byval e system.windows.forms.formclosingeventargs) e.cancel = true end sub public sub enableopenforms() each frm form in application.openforms frm.enabled = true removehandler frm.formclosing, addressof blockformclosing next end sub the calling form open stay-open form forceopen(formstayopen). when stay-open form's conditions allowing user close have been satisfied, have call enableopenforms().
Comments
Post a Comment