تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] تكست بوكس
#1
اخواني كيف اجعل التكست بوكس لا يقبل الا  ارقام
وتكست بوكس اخر لا يقبل الا احرف
الرد }}}
تم الشكر بواسطة:
#2
في حدث ال keypress  :

كتابة الاحرف فقط :
PHP كود :
If System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[^a-zA-Z0-9()\b]"Then
       e
.Handled True
    End 
If 
او :
PHP كود :
If Not (Asc(e.KeyChar) = 8Then
        Dim allowedChars 
As String "abcdefghijklmnopqrstuvwxyz"
 
       If Not allowedChars.Contains(e.KeyChar.ToString.ToLowerThen
            e
.KeyChar ChrW(0)
 
           e.Handled True
        End 
If
 
   End If 

كتابة ارقام فقط:
PHP كود :
If Asc(e.KeyChar) <> 8 Then
        If Asc
(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
            e
.Handled True
        End 
If
 
   End If 

الرد }}}
#3
(06-10-19, 02:46 PM)Rabeea Qbaha كتب : في حدث ال keypress  :

كتابة الاحرف فقط :
PHP كود :
If System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[^a-zA-Z0-9()\b]"Then
       e
.Handled True
    End 
If 
او :
PHP كود :
If Not (Asc(e.KeyChar) = 8Then
        Dim allowedChars 
As String "abcdefghijklmnopqrstuvwxyz"
 
       If Not allowedChars.Contains(e.KeyChar.ToString.ToLowerThen
            e
.KeyChar ChrW(0)
 
           e.Handled True
        End 
If
 
   End If 

كتابة ارقام فقط:
PHP كود :
If Asc(e.KeyChar) <> 8 Then
        If Asc
(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
            e
.Handled True
        End 
If
 
   End If 

اخي الكريم شكرا لك ارسلت ثلاثة اكواد اثنان منهم تجعل التكست لايدخل به إلا ارقم والثالث لايكتب الا  اللغة العربية
لكن لم ترسل لم اجد منع كتابة الارقام

(06-10-19, 03:42 PM)المنذر كتب :
(06-10-19, 02:46 PM)Rabeea Qbaha كتب : في حدث ال keypress  :

كتابة الاحرف فقط :
PHP كود :
If System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[^a-zA-Z0-9()\b]"Then
       e
.Handled True
    End 
If 
او :
PHP كود :
If Not (Asc(e.KeyChar) = 8Then
        Dim allowedChars 
As String "abcdefghijklmnopqrstuvwxyz"
 
       If Not allowedChars.Contains(e.KeyChar.ToString.ToLowerThen
            e
.KeyChar ChrW(0)
 
           e.Handled True
        End 
If
 
   End If 

كتابة ارقام فقط:
PHP كود :
If Asc(e.KeyChar) <> 8 Then
        If Asc
(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
            e
.Handled True
        End 
If
 
   End If 

اخي الكريم شكرا لك ارسلت ثلاثة اكواد اثنان منهم تجعل التكست لايدخل به إلا ارقم والثالث لايكتب الا  اللغة العربية
لكن لم ترسل لم اجد منع كتابة الارقام

عفوا اخي احد الاكواد لايقبل الا ادخال اللغة الانكليزية والاثنين الاخرين يمنعان ادخال الاحرف
اريد منع ادخال الارقم وقبول الاحرف فقط
الرد }}}
تم الشكر بواسطة: حريف برمجة , asemshahen5
#4
http://vb4arb.com/vb/showthread.php?tid=10467

اتمنى ان يفيدك هذا
الرد }}}
تم الشكر بواسطة: حريف برمجة , حريف برمجة , asemshahen5
#5
كود :
If Not (Asc(e.KeyChar) = 8) Then
       Dim allowedChars As String = "abcdefghijklmnopqrstuvwxyz"
       If Not allowedChars.Contains(e.KeyChar.ToString.ToLower) Then
           e.KeyChar = ChrW(0)
           e.Handled = True
       End If
   End If

الحروف التي في النص هي الاخرف المقبولة ، فا اذا اردت فقط احرف عربية اكتب الاحرف العربية بدل الانجليزية وهكذا 
PHP كود :
   Dim allowedChars As String "abcdefghijklmnopqrstuvwxyz" 

الرد }}}
تم الشكر بواسطة: المنذر , حريف برمجة , asemshahen5
#6
(06-10-19, 04:34 PM)Rabeea Qbaha كتب :
كود :
If Not (Asc(e.KeyChar) = 8) Then
       Dim allowedChars As String = "abcdefghijklmnopqrstuvwxyz"
       If Not allowedChars.Contains(e.KeyChar.ToString.ToLower) Then
           e.KeyChar = ChrW(0)
           e.Handled = True
       End If
   End If

الحروف التي في النص هي الاخرف المقبولة ، فا اذا اردت فقط احرف عربية اكتب الاحرف العربية بدل الانجليزية وهكذا 
PHP كود :
   Dim allowedChars As String "abcdefghijklmnopqrstuvwxyz" 

شكرا اخي كثير كله تمام وفقك الله
الرد }}}
تم الشكر بواسطة: حريف برمجة , asemshahen5



التنقل السريع :


يقوم بقرائة الموضوع: