vb.net - Parameterizing the Handler of a sub -
this question has answer here:
i have ten images on winform , i'm trying handle in 1 sub click of of ten images. images have following naming lblplayer1, lblplayer2 etc want call click event of images clicked.
private sub lblplayer1_click(sender object, e eventargs) handles lblplayer(x).click end sub
is possible?
private sub lblplayers_click(byval sender object,byval e eventargs) handles lblplayer1.click, lblplayer2.click, lblplayer3.click, etc... end sub
or else:
somesub() handles mybase.load each ctrl control in {lblplayer1, lblplayer2, lblplayer3, etc...} addhandler ctrl.click, adressof lblplayers_click next ctrl end sub private sub lblplayers_click(byval sender object,byval e eventargs) ' stuff here... end sub
Comments
Post a Comment