Click here to Skip to main content
15,887,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 16-Nov-12 19:16pm
v2
Comments
Rob Branaghan 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

 
Share this answer
 
Comments
Niamatullah Habibi 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 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?
kareemakrm 5-Feb-16 4:44am    
i want to allow arbic char in textbox with vb.net
Jacques Loubser 21-Nov-12 6:25am    
Just Validate the Arabic in Unicode. Keep the ASCII for the English
Niamatullah Habibi 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900