久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

字符串操作

 barbarossia 2006-09-26

‘************************************
‘函數(shù)名:    DataLength_Limit()
‘參數(shù)  :    obj :需處理的TEXTBOX對(duì)象

‘返回值:    無

‘說明  :    處理中文字符長度,,限制輸入byte數(shù)超過Text.MaxLength的中文字符
‘************************************

Public Sub DataLength_Limit(obj As TextBox) ‘, MaxLen as Integer)
    Dim iLenUnicode As Integer
    Dim i As Integer
    Dim MaxLen As Integer
    Dim sText As String
    Dim j As Integer
   
    j = obj.SelStart
    sText = obj.Text
    MaxLen = obj.MaxLength
   
   
    If sText = "" Or MaxLen = 0 Then
        Exit Sub
    End If
   
    iLenUnicode = Len(sText)
   
    For i = 1 To iLenUnicode
        If lstrlen(sText) > MaxLen Then
            iLenUnicode = iLenUnicode - 1
            sText = Left(sText, iLenUnicode)
        Else
            Exit For
        End If
    Next i
   
    obj.Text = sText
    obj.SelStart = j
End Sub
 
 
 
 ‘************************************
‘函數(shù)名:    NumKeyPress()
‘參數(shù)  :    obj :需處理的TEXTBOX對(duì)象
‘           Keyascii:需處理的ascii字符
‘           IntPlaces:最大整數(shù)位
‘           DecPlaces:最大小數(shù)位
‘返回值:    數(shù)字字符

‘說明  :    限制輸入非數(shù)字字符,,確保輸入的為允許有效數(shù)字
‘************************************
Public Function NumKeyPress(obj As TextBox, KeyAscii As Integer, IntPlaces As Integer, DecPlaces As Integer) As Integer
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    Dim ilen As Integer
    NumKeyPress = KeyAscii
    i = obj.SelStart
    j = InStr(obj.Text, ".")
    k = obj.SelLength
    ilen = Len(obj.Text)
    If KeyAscii = vbKeyBack Then
        If k = 0 Then
            If i = j Then
                If ilen - 1 > IntPlaces Then
                    NumKeyPress = 0
                End If
               
            End If
        Else
            If InStr(obj.SelText, ".") > 0 Then
                If ilen - k > IntPlaces Then
                    NumKeyPress = 0
                End If
            End If
        End If
    End If

    If KeyAscii >= 33 Then
        If (KeyAscii < vbKey0 Or KeyAscii > vbKey9) And KeyAscii <> 46 Then
            NumKeyPress = 0
        Else
            If KeyAscii = 46 Then
                If InStr(obj.Text, ".") > 0 Then
                    NumKeyPress = 0
                End If
            Else
                    If j > 0 Then
                        If i >= j And (ilen - j) >= DecPlaces Then
                            NumKeyPress = 0
                        ElseIf i < j And j >= IntPlaces + 1 Then
                            NumKeyPress = 0
                        End If
                    Else
                        If ilen >= IntPlaces Then
                            NumKeyPress = 0
                        End If
                    End If
           
            End If
        End If
    End If
End Function
 
 

‘************************************
‘函數(shù)名:    NumKeyDown()
‘參數(shù)  :    obj :需處理的TEXTBOX對(duì)象
‘           KeyCode:需處理的KeyCode字符
‘           IntPlaces:最大整數(shù)位
‘           DecPlaces:最大小數(shù)位
‘返回值:    數(shù)字字符

‘說明  :    限制輸入非數(shù)字字符,,確保輸入的為允許有效數(shù)字,,主要響應(yīng)“Delete”健
‘************************************
Public Function NumKeyDown(obj As TextBox, KeyCode As Integer, IntPlaces As Integer, DecPlaces As Integer) As Integer
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    Dim ilen As Integer
    NumKeyDown = KeyCode
    i = obj.SelStart
    j = InStr(obj.Text, ".")
    k = obj.SelLength
    ilen = Len(obj.Text)
    If KeyCode = 46 Then
        If k = 0 Then
            If i + 1 = j Then
                If ilen - 1 > IntPlaces Then
                    NumKeyDown = 0
                End If
               
            End If
        Else
            If InStr(obj.SelText, ".") > 0 Then
                If ilen - k > IntPlaces Then
                    NumKeyDown = 0
                End If
            End If
        End If
    End If
End Function
‘************************************
‘函數(shù)名:    pbCheckChar
‘參數(shù)  :   intKeyascii:需處理的Keyascii字符
‘‘返回值:    數(shù)字字符

‘說明  :    限制輸入字符,,確保輸入的為允許字符
‘************************************
Public Function pbCheckChar(intKeyascii As Integer) As Integer
    If intKeyascii = 37 Or intKeyascii = 34 Or intKeyascii = 39 Or intKeyascii = 63 Then
        pbCheckChar = 0
    Else
        pbCheckChar = 1
    End If
End Function

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多