一夜未眠,求极一小段代码! 务必请大家帮帮忙!
就是在程序运行时动态加入一个按钮,然后如何添加他的onClick时间,在默认的选项中只有onClientClick事件!请高手帮帮忙吧,谢谢!
Dim Row As New TableRow
Dim cell As New TableCell
Dim btnB As New Button
btnB.Text = "提交 "
cell.Controls.Add(btnB)
cell.CssClass = "tBody2 "
Row.Cells.Add(cell)
------解决方案-------------------- Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim btnB As New Button
btnB.Text = "提交 "
Me.Label1.Controls.Add(btnB)
AddHandler btnB.Click, AddressOf Me.Letter_Clicked
End Sub
Private Sub Letter_Clicked(ByVal sender As Object, ByVal e As System.EventArgs)
MsgBox( "aaaa ")
End Sub
End Class
------解决方案--------------------Button btn = new Button();
btn.Text = "test ";
btn.Click += new EventHandler (btn_Click);
Panel1.Controls.Add(btn);
vs2003试过,正常
------解决方案--------------------Button btn = new Button();
btn.Text = "test ";
btn.Click += new EventHandler (btn_Click);
Panel1.Controls.Add(btn);
这个好学点吧!