怎样动态添加按钮控制新打开的子窗体?
比如新打开一个子窗体时,窗口自动添加一个按钮,每个按钮控制一个子窗体,当按下按钮触发被控制的子窗体的.Activate()
应该如何实现呢?
谢谢!
[解决办法]
假设当前添加FormN的对应按钮
Dim FormN As Form
Dim MyButton As New Button
MyButton.Tag = FormN
AddHandler MyButton.Click, AddressOf Button_Click
Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyForm = CType(CType(sender, Button).Tag, Form)
MyForm.Activate()
End Sub