我在vb.net中動態創建一些按鈕,但我無法創建單擊事件處理程序。將事件添加到按鈕陣列
這是我的代碼:
dim b(10)
dim x=0
b(x) = New Button
b(x).width = 100
b(x).height = 25
b(x).location = New Point(500, pos + 24)
b(x).visible = True
b(x).text = "Remove"
AddHandler b(x).Click, AddressOf remove_click
我收到以下錯誤,當我嘗試編譯 「點擊」不是「對象」的事件。
Public Sub remove_click(sender As Object, e As EventArgs)
' onclick code
End Sub