• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 在TEXT文本框中只允許輸入數字和小數點,如何實現?只能編程實現嗎?

    發表于:2007-05-25來源:作者:點擊數: 標簽:框中只允許輸入Text文本
    在TEXT文本框中只允許輸入數字和小數點,如何實現?只能編程實現嗎? Private Sub Text1_KeyPress(KeyAscii As Integer) If (Chr(KeyAscii) "9" Or Chr(KeyAscii) "0") And Chr(KeyAscii) "." Then KeyAscii = 0 End If End Sub 回復人:y1g1y1(袁飛☆曾經滄

    在TEXT文本框中只允許輸入數字和小數點,如何實現?只能編程實現嗎?

     

    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If (Chr(KeyAscii) > "9" Or Chr(KeyAscii) < "0") And Chr(KeyAscii) <> "." Then
        KeyAscii = 0
    End If
    End Sub

        回復人:y1g1y1(袁飛☆曾經滄海難為水,除卻VB不是云☆) 



    在keypress中進行判斷,如果不合格就sendkeys(vb_backspace)
    具體函數的參數我不太會寫了,就是用sendkeys的 
     回復人:playyuer(女㊣愛) (2001-5-8 13:09:00)  得0分
    Private Sub Text1_KeyPress(KeyAscii As Integer)
      Select Case KeyAscii
          Case Asc("-") '允許負數
                If Text1.SelStart = 0 Then
                  If Left(Text1.Text, 1) = "-" Then
                      KeyAscii = 0
                      Beep
                  End If
                Else
                  KeyAscii = 0
                  Beep
                End If
            Case 8
                  '無變化,退格鍵不屏蔽
            Case Asc(" ") '32
                If Text1.SelLength = 0 Then
                    KeyAscii = 0
                End If
            Case Asc(".") '46 '允許小數點
                If InStr(Text1.Text, ".") Then
                    KeyAscii = 0
                End If
            Case Is < Asc(0) '48
                  KeyAscii = 0
            Case Is > Asc(9) '57
                  KeyAscii = 0
      End Select
    End Sub 

     回復人:liu_feng_fly(一只菜鳥,忽忽悠悠的就飛來了??!)

     

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>