毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

VB录入字符时限制格式和字符 第2页

更新时间:2012-5-18:  来源:毕业论文
Private Sub Text1_KeyUp(Index As Integer, KeyCode As Integer, Shift As Integer)
    If Text1(Index).Text <> "" Then
        If Text1(Index).SelStart = 0 Then
            If Index > 0 Then Text1(Index - 1).SetFocus
        ElseIf Text1(Index).SelStart = 2 Then
            If Index < 5 Then Text1(Index + 1).SetFocus
        End If
    End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    Dim L As Long
    L = Text1.SelStart
    If L < 18 Then
        If KeyAscii = 8 Then Exit Sub
        If L Mod 3 = 2 Then
            If KeyAscii <> Asc("-") Then KeyAscii = 0
        Else
            If Not ((Asc("0") <= KeyAscii And KeyAscii <= Asc("9")) Or (Asc("A") <= KeyAscii And KeyAscii <= Asc("F")) Or (Asc("a") <= KeyAscii And KeyAscii <= Asc("f"))) Then
                KeyAscii = 0
            Else
                KeyAscii = Asc(UCase(Chr(KeyAscii)))
            End If
        End If
    Else
        If KeyAscii <> 13 And KeyAscii <> 8 Then KeyAscii = 0
    End If

End Sub

上一页  [1] [2] 

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。