vb.net - How to check if event has been fired in another form/class -


so putting possible, have 1 class opens form inside sub so:

public sub loadextension()      'various code...      dim form new frmmain     frmmain.showdialog()      'various code...  end sub 

and inside form have 2 buttons, 1 close form, loadextension() sub continue. other button want use 'exit' loadextension() sub inside main class loading stops completely. button event inside form module so:

private sub btnstopload_click(sender object, e eventargs) handles btnstopload.click     'exit loadextension sub somehow end sub 

what simplest way achieve this? thought in loadextension() sub (after .showdialog):

if frmmain.btnstopload.clicked     exit sub end if 

but won't let me class module, apparently need use 'raise event' or something? i'm not familiar way events work. can offer me easy solution? i'd grateful. i've been looking around web solution haven't had success. time.

you can achieve setting dialogresult of frmmain.

public class frmmain     inherits form      private sub _buttoncontinueclick(sender object, e eventargs) handles buttoncontinue.click         me.dialogresult = windows.forms.dialogresult.ok         me.close()     end sub      private sub buttonexitclick(sender object, e eventargs) handles buttonexit.click         me.dialogresult = windows.forms.dialogresult.cancel         me.close()     end sub  end class 

then change loadextension method this:

public sub loadextension()      'various code...      using form new frmmain()         if (form.showdialog() <> windows.forms.dialogresult.ok)             exit sub         end if     end using      'various code...  end sub 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -