I need to fix the English language as input language even if the user selects Arabic keyboard for particular textbox.
Is it possi开发者_如何转开发ble?
Once I set the input languae as English, it's changing to all textboxes and labels. But I am looking to fix it to English language for a particular textbox only.
Yes, it's possible using the following in the Windows application.
private void textBox2_Enter(object sender, EventArgs e)
{
System.Globalization.CultureInfo TypeOfLanguage = new System.Globalization.CultureInfo("en-us");
InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(TypeOfLanguage);
}
this.textBox1.KeyDown += new KeyEventHandler(textBox1_KeyDown);
You can add KeyEventHandler
for your textbox, if you are using the WinForms, and analize the KeyDown
event, something like that
It defaults to English language I believe, and I don't think there is any "language" property present for textbox ... provided it's a web form. Take a look at Stack Overflow post Change input language for selected Controls - ASP.NET.
If this is WebForms you may well be able to use the solution in this question: Arabic text box
Something like (using jQuery):
$("#textBox").attr("lang", "en");
精彩评论