Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a c# form application with a text box and a button. I type Chinese character in the text box and press the button to assign the input to a string using the following code
<br />
String  chineseChar = Textbox1.Text ; 

// TextBox font property: Arial Unicode MS or SimSun

But it assigns empty string to chineseChar variable.

When I copy a chinese text from a MS word and paste it to the textbox, it works.

Where the problem?

Environment:

VS 2008, C# .net framework 3.5

Windows XP or upper

Ms PinYin IME 3.0
Posted
Comments
Radhakrishnan G. 3-Nov-10 11:22am    
You are not able to enter the chineese character?
Yusuf 3-Nov-10 11:28am    
Your question is not clear. What your problem? Is it typing Chinese characters into the text box or saving the Chinese characters to your string? Are you using Unicode characters?
akul123 8-Nov-10 23:04pm    
When I type chinese character, they show up in the chinese char in the text box. There is no problem to type chinese character. But When i type in chinese character and assign the characters to a string type variable then empty string is assigned to the variable.
When I copy a chinese text from a MS word and paste it to the textbox, it assigns a string (that i paste to the text box)to the str variable. In this case, empty string is not assigned.

This StackOverflow thread seems to be on the same issue:

http://stackoverflow.com/questions/3287180/putting-ime-in-a-custom-text-box-derived-from-control[^]

In his case he's using a custom control, but you may need to do something similar with a TextBox too.
 
Share this answer
 
It works.

it took some time to echo chinese character in the text box. I pressed button before all characters echo in the text box and that's why it assigned empty string.

Thanks all for response.
 
Share this answer
 

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