這樣或那樣的方式我需要將groupID(和另一個整數)鏈接到我動態添加的按鈕..任何想法?AddressOf帶參數
我能做些什麼;
AddHandler mybutton.Click, AddressOf PrintMessage
Private Sub PrintMessage(ByVal sender As System.Object, ByVal e As System.EventArgs)
MessageBox.Show("Dynamic event happened!")
End Sub
我不能做的,但想要;
AddHandler mybutton.Click, AddressOf PrintMessage(groupID)
Private Sub PrintMessage(ByVal groupID as Integer)
MessageBox.Show("Dynamic event happened!" & groupID .tostring)
End Sub
請參閱http://stackoverflow.com/questions/13401246/how-to-pass-parameters-in-addhandler-using-vb-net – 2016-01-28 12:59:52