Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
I know how to restrict the users in entering character of English language as it is the first time that i am developing an student application in nonenglish language, therefor it would be your kind to answer my question. thanks
Posted 13-Nov-12 23:17pm
Edited 16-Nov-12 19:16pm
v2
Comments
Rob@Love2Code at 14-Nov-12 6:30am
   
I know this might sound a little strange, but being a dual language speaker, sometimes I don't know the word in my other language, and thereby use the English word. (I believe people refer to this as Double Dutch)
Perhaps restricting the allowed characters is not a good idea?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Niamatullah habibi at 19-Nov-12 23:59pm
   
As i mentioned that i am using vb.net 2010 and i have a window application, it is going to be used in Arabic language and as well as in English language for English language i have done the validation rule like below is my code. what is my problem is that i want to do the same validation rule for Arabic language that the user may not be able to write numeric value in textbox where only text is allowed and viceversa text should not be written in the textbox where only numeric value is allowed to be thanks.
 
Private Sub txtTrnCnt_Name_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTrnCnt_Name.KeyPress
If (Microsoft.VisualBasic.Asc(e.KeyChar) < 65) _
Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 90) _
And (Microsoft.VisualBasic.Asc(e.KeyChar) < 97) _
Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 122) Then
'Allowed space
If (Microsoft.VisualBasic.Asc(e.KeyChar) <> 32) Then
e.Handled = True
End If
End If
' Allowed backspace
If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
e.Handled = False
End If
End Sub
Jacques Loubser at 20-Nov-12 1:23am
   
Try using the Unicode codes to validate the input. Look at Wikipeadia for the unicode ranges. You will have to work out what is Letters and what is numbers.
Have you thought of a virtual keyboard with the letters only typing in the letters box and visa versa?
Jacques Loubser at 21-Nov-12 6:25am
   
Just Validate the Arabic in Unicode. Keep the ASCII for the English
Niamatullah habibi at 23-Nov-12 2:43am
   
Dear all as i am new in vb.net, i need your help, please any body can to write the events to validate the user for writing in the textbox only Arabic characters, it would be your kind. thanks in advance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,034
1 Sergey Alexandrovich Kryukov 4,838
2 Peter Leow 3,129
3 Maciej Los 3,079
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 17 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100