vb.net - how to execute part of the code in an another sub procedure -
suppose have 2 buttons btncheck , btnok. want execute few lines code of btncheck btnok. when click on btnok, btnok's code btncheck's code should executed 1 after other. how can in vb.net
private sub btnok_click(byval sender system.object, byval e system.eventargs) handles btnok.click .................................. ..............codes 1............. .................................. .........codes btncheck...... .................................. end sub private sub btncheck_click(byval sender system.object, byval e system.eventargs) handles btncheck.click .................................. ..............codes 2............... .................................. end sub
[ can done using goto ? ]
in addition making separate procedure has been suggested, can call other sub if want run of code:
private sub btnok_click(byval sender system.object, byval e system.eventargs) handles btnok.click '... btncheck_click(sender, e) 'this run btncheck code end sub private sub btncheck_click(byval sender system.object, byval e system.eventargs) handles btncheck.click '... end sub
try avoid using goto
in code if @ possible, there's better way using other control structures.
Comments
Post a Comment