Private Sub Command1_Click()
Dim x As Integer
If x = 1 Then
    Text1.Locked = True
    Text2.Locked = True
End If
End Sub本人想利用单击Command1 来控制Text1和Text2的输入.我想要实现的功能:体是当我第一次单击Command1时,实现Text1不能输入,Text2可以输入.当我第二次单击Command1时,实现Text1能输入,Text2不能输入,当第三次单击Command1时,Text1和Text2都不能输入!

解决方案 »

  1.   

    dim AllowInput as integerprivate sub Form_Load()
            AllowInput=1 
    end sub
    Private Sub Command1_Click() 
            if AllowInput=1 then
               Text1.Enabled=false
               Text2.Enabled=true
               AllowInput=2
            endif
            if AllowInput=2 then
               Text1.Enabled=true
               Text2.Enabled=false
               AllowInput=3
            endif
            if AllowInput=3 then
               Text1.Enabled=false
               Text2.Enabled=false
               AllowInput=1
            endif 
    End Sub 
      

  2.   

    运行的时候当我点击第一次COMMAND1时2个文本框就不能用拉.而不是我想要的结果.我要实现的是当我第一次点击COMMAND1时,第一个文本框不能输入,而第二个还是可以输入的.不知道各位高手还有什么方法实现,请赐教.
    谢谢chenjl1031 和jms918 的帮助
      

  3.   

    不可能啊,我3楼那个完全没有问题。注意:我没有使用Text1.Locked=True, Text2.Locked=True,锁定文本框。 
      

  4.   

    很简单dim a as long
    Private Sub Command1_Click()
    if a=0 then
    text1.locked=true
    text2.locked=false
    a=1
    elseif a=1 then
    text1.locked=false
    text2.locked=true
    a=0
    end if
    End Sub用a变量来判断就行了