แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - NattakornC

หน้า: [1]
1
อ้างถึง
บ้านเลขที่ ให้เป็นตัวเลขและ มี / ได้
Private Sub txtAddress_KeyPress(KeyAscii As Integer)
If (KeyAscii > 46 And KeyAscii < 58)  Then
      KeyAscii = KeyAscii
      Else:
      KeyAscii = 0
   End If
End Sub

อ้างถึง
3. เบอร์ = ตัวเลข ใน tbl เป็น text

สมมุติ txtPhoneNumber

Private Sub txtPhoneNumber_KeyPress(KeyAscii As Integer)
If (KeyAscii > 47 And KeyAscii < 58) Or (KeyAscii = 8) Then
      KeyAscii = KeyAscii
      Else:
      KeyAscii = 0
   End If
End Sub

จะพิมพ์ได้เฉพาะตัวเลขครับ แต่สามารถใช้ Space Bar ได้ เผื่อว่าต้องการพิมพ์เบอร์ 000 0000000  แบบนี้
อ้างถึง
NameEN = เฉพาะอักษรภาษาอังกฤษ

Private Sub txtWordsEng_KeyPress(KeyAscii As Integer)
If (KeyAscii > 65 And KeyAscii < 90) Or (KeyAscii > 97 And KeyAscii < 122) Then
 KeyAscii = KeyAscii
      Else:
      KeyAscii = 0
End If
End Sub
อ้างถึง
ชื่อไทย = เฉพาะอักษรไทย
Private Sub txtWordsTH_KeyPress(KeyAscii As Integer)
If Not (KeyAscii > 0 And KeyAscii < 32) And Not (KeyAscii > 32 And KeyAscii < 127) Then
 KeyAscii = KeyAscii
      Else:
      KeyAscii = 0
End If
End Sub

สำหรับ ใส่ชื่อไทย กำหนดให้ยอมรับการกด Spacebar ได้เพื่อให้เว้นช่องว่างกรณี มีทั้งชื่อและนามสกุล
โพสต์นี้ได้รับคำขอบคุณจาก: NattakornC

หน้า: [1]