我建了一个TXT控件数组,,对起输入进行约束,,代码写在KeyPress里,,可是只能对第一个控件起作用,,怎么解决啊

解决方案 »

  1.   

    用循环,for i=0 to UBound(控件数组)
            next  
      

  2.   

    Private Sub TxtObj_KeyPress(Index As Integer, KeyAscii As Integer)End Sub一个控件数组的中某一控件对象的引用采用index来区分,可能你没有限制index
      

  3.   

    不需要对index限制啊!
    如:
    Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    If KeyAscii = 8 Then KeyAscii = 0 '你无法用退格键删除了
    End Sub