要给100个textbox的值改变事件 都添加 a()
要给100个button的单击事件 都添加b()
要给100个下拉框都添加索引改变事件 c()
For Each T As Control In TabPage1.Controls
Select Case T.GetType.ToString
Case "System.Windows.Forms.TextBox", "System.Windows.Forms.Label", "System.Windows.Forms.ListBox"
AddHandler T.TextChanged, AddressOf dwstring
Case "System.Windows.Forms.Button"
T()
AddHandler T.Click, AddressOf dwstring
End Select
Next
这是我瞎写的
textbox的 TextChanged ok了
button的click ok了
但是t没有selectindexchanged 事件
我怎么给listbox 批量添加 selectindexchanged 事件?
------解决思路----------------------
用CType转化成TextBox、Button等等类型
------解决思路----------------------
判断是IListControl,转换类型后就有了