如何在VB6中向索引控件添加事件处理程序
我有索引控件: txtInput(0),txtInput(1),txtInput(2)
但是当我向他们创建事件时,如 txtInput(0)_Click ,错误显示...... 请告诉我如何解决它。谢谢!
答案 0 :(得分:0)
只需将代码添加到控件的click事件中即可。由于它是一个数组,因此单击控件的索引将是事件处理程序的参数:
Private Sub txtInput_Click(Index as Integer)
If Index = 0 then
'code for first control
ElseIf Index = 1 then
'code for second control
Else
' and so on ....
End If
End Sub