Changing the default language in specific textBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

my user default language is hebrew but in some cases i want that the default
language in specific textBox will be english (i mean that when the user will
hit the 'T' key he will get a T in the textBox and not the parallel letter in
hebrew) what is the best way to do it? i can always check which letter the
user hit and then change it to the english parallel in the keyboard, but i
don't think this is the best way.

thanks,
Gidi.
 
Gidi,

To my knowledge, the culture/language settings are specific to the
thread, not to individual controls. Because of this, you would have to do
exactly what you mentioned, which would be to monitor the keys and provide
your own mappings between the keys and the letters displayed by the textbox.

Hope this helps.
 
Hi Nicholas,

I tried to that and i'm having a problem, i can't make the textBox to
display the text right.
this is my function:

private void neshek_num_txt_KeyUp(object
sender,System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode!=Keys.Enter && e.KeyCode!=Keys.Alt && e.KeyCode!=Keys.Tab)
{
string temp=neshek_num_txt.Text.Trim();
string let="";
int len=temp.Length;
string new_line="";
if(len>0)
let=mf.Change_Langauge(temp[len-1].ToString());
for(int i=0;i<len-1;i++)
new_line=new_line+temp.ToString();
new_line=new_line+let;
neshek_num_txt.Text=new_line;

}

}

the function Change_Langauge() gets the hebrew letter and returns the
parallel letter on the keyboard.
my problems are:
1. sometimes it takes the computer lots of time to respond (like it gets
into a loop) and only by hiting ctrl+akt+del releases it.
2. if i pressed C and Z i get only the hebrew letter of Z.

what is wrong in my function? how can i make the cursor to be at the end of
the line?

Thanks,
 
You can detect an English character if the current language setting is Hebrew. What you can do - is
when the textbox gets focused, change the keyboard to English, and back to Hebrew (or better yet save
and restore whatever the user had) on exit.

I have English, Russian, Greek, German, and Arabic installed on my system and many applications
that work in multiple languages.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top