1,限制文本框只能接收数字0-9,当输入其他字符时只发出错误警告声提示。
2,if 已收到3个字符 then 另一个控件.SetFocus
3,取得刚刚在文本框内的最后一字符
先来先得,如果有更正确的答案,分数酌情给。

解决方案 »

  1.   

    问题1
    Function Fun_KPS只能输入0到9(KeyAscii As Integer) As Integer
        
        If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And KeyAscii <> 8 And KeyAscii <> 13 And KeyAscii <> 3 And KeyAscii <> 22 And KeyAscii <> 24 And KeyAscii <> 26 Then
           Fun_KPS只能输入0到9 = 0
           MsgBox "此处只能输入0到9的数字!", , "系统提示"
        Else
           Fun_KPS只能输入0到9 = KeyAscii
        End IfEnd Function
      

  2.   

    问题2
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
        If Len(Trim(Text1.Text)) = 2 Then
            Text2.SetFocus
        End If
    End Sub
      

  3.   

    问题3
    Private Sub Text2_GotFocus()
        MsgBox Right(Trim(Text1.Text), 1)
    End Sub或者
    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
        If Len(Trim(Text1.Text)) = 2 Then
            Text2.SetFocus
            MsgBox Chr(KeyCode)
        End If
    End Sub
      

  4.   

    1.FUNction valitext(keyin as integer ,validatastring,Editable as boolean ) as integer
     dim validatalist as string 
     dim keyout as integer
     if editable=true then 
     validatalist=ucase(validatastring)&chr(8)
     else
     validatalist=ucase(validatastring)
     end if
     if instr(1,validatalist,ucase(chr(keyin)),1)>0 
     then 
    keyout=keyin
    else 
    keepout=0
     beep
    end if
     valitext=keyout
    end functionprivate text1_keypress(keyascii as integer)
    keyascii=valitext(keyascii,"0123456789",true)
    end private
      

  5.   

    2. private sub text1_keypress(keyascii as integer)
       if keyascii=13 then 
        if len(text1.text)=3 then  
        text2.setfocus
        end if
       end if
       end sub
      

  6.   

    第一个问题这样最简单吧
    If Not IsNumeric(TxtBackodo.Text) Then
            MsgBox "抱歉!您必须输入0-9的数字", vbOKOnly, "警告"
    end if
      

  7.   

    If Not IsNumeric(TxtBackodo.Text) Then
            beep
    end if
      

  8.   

    1,dlpseeyou(豆子) 10
    2,dlpseeyou(豆子) 10
    3.通过SoHo_Andy(冰)的答案自己推出来的,原方案不怎么好用。 8感谢:cooket(见光死) 和tianyxy(天涯夕阳)的支持。