VB.net Handles 问题

[复制链接]
查看11 | 回复2 | 2013-10-20 16:01:56 | 显示全部楼层 |阅读模式
对于批量的对象就用循环好了,一个一个复制粘贴并不是很好的解决方案。首先写好事件处理函数。Private Sub TextBoxChanged(sender As Object, e As EventArgs)'一些代码End Sub下面是主函数Dim tests() As TextBox '数组或集合字段名称用复数Dim num As Integer = 80 '控件总个数ReDim tests(num)For i = 0 To tests.Count - 1Dim item As New TextBoxtest(i) = itemAddHandler item.TextChanged, Addres...
回复

使用道具 举报

千问 | 2013-10-20 16:01:56 | 显示全部楼层
之所以可以 Handles ,是因为窗体设计代码中有这么一句:Friend WithEvents TextBox1 As System.Windows.Forms.TextBox而用 WithEvents 是不可以声明数组的,所以 test() 这类控件数组就不可 Handles 了。 只能是Sub a(ByVal sender As System....
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行