在網頁或是win form程式中
如果在我們輸入的文字方塊中,只允許半型的文數字輸入時
可以透過以下的方法來檢查
如果回傳的值是False表示輸入的文數字中有全型的文數字
註:如果是asp.net的程式,請將這一段程式放在post back的程式碼裏面…

Private Function CheckInputCharType(ByVal stud_no As String) As Boolean
    CheckInputCharType= True
    Dim intAsc As Integer
    Dim i As Integer = 0
    For i = Len(stud_no) To 1 Step -1
        intAsc = Asc(Mid(stud_no, i, 1))
        If intAsc > 0 And intAsc Then
        Else
           Return False
        End If
    Next
End Function

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 湯瑪的吳 的頭像
    湯瑪的吳

    安達利機車行

    湯瑪的吳 發表在 痞客邦 留言(0) 人氣()