问题延续

LostAngel911 2002-09-09 09:22:53
怎么动态生成一组BUTTON,并为这一组BUTTON写CLICK事件的代码
同时还可以知道按的是哪一个按纽
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Montaque 2002-09-10
  • 打赏
  • 举报
回复
给你一段代码!
/////////////////////////////////////
Private Sub handling_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox(sender.text)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim btna As New System.Windows.Forms.Button()
Dim btnb As New System.Windows.Forms.Button()
AddHandler btna.Click, AddressOf handling_click
AddHandler btnb.Click, AddressOf handling_click
btna.Visible = True
btna.Width = 80
btna.Height = 20
btna.Text = "Button1"
btna.Location = New Point(10, 10)
btnb.Visible = True
btnb.Width = 80
btnb.Height = 20
btnb.Text = "Button2"
btnb.Location = New Point(10, 50)
Me.Controls.Add(btna)
Me.Controls.Add(btnb)

End Sub

---------------------------------------------------------
Montaque==Digitalboy==Houyongfeng==Monkey
LostAngel911 2002-09-09
  • 打赏
  • 举报
回复
没人帮我吗?

16,720

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧