برای اینکه یک تعداد کاراکتر خاص را در TextBox 1 کنیم میتوانیم از روش زیر استفاده نماییم.
به طور مثال :
مثلاً اجازه دهیم فقط 1 "0123456789ABCDEFabcdef" در TextBox 1 گردد.

Option Explicit
Public Sub TextFilter(KeyAscii As Integer)
Dim strValid As String
strValid = "0123456789ABCDEFabcdef"
If KeyAscii > 26 Then
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
TextFilter KeyAscii
End Sub


موضوعات مرتبط: Visual Basic
برچسبها: محدود 1 , کاراکترهای , تایپ شده , TextBox
برچسب:
نویسنده: مریم نیکنام