I don't know how to edit my post. I have one more question. If I would like add 10 buttons on the form programmaticall, how do I create a loop to get Friend WithEvents Button1 as New Button, Friend WithEvents Button2 as New Button... ? How do I write code in class level?
Second, if I want to create click event using the following:
AddHandler btn0.click, addressof ClickHandler
Private Sub ClickHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
'put codes here
End Sub
1. I got syntex error on AddHandler. What was wrong?
2. How do I use a loop to create AddHandler btn0.click, addressof clickHandler, AddHandler btn1.click, addressof clickHandler, ...
Thanks.
DanYeung
ps I saw the Edit button after I posted this.
Second, if I want to create click event using the following:
AddHandler btn0.click, addressof ClickHandler
Private Sub ClickHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
'put codes here
End Sub
1. I got syntex error on AddHandler. What was wrong?
2. How do I use a loop to create AddHandler btn0.click, addressof clickHandler, AddHandler btn1.click, addressof clickHandler, ...
Thanks.
DanYeung
ps I saw the Edit button after I posted this.
Last edited: