Allow text from different cultures in Textbox C# - c#

I have an application in which username is both in English and Japanese(for Japanese users.)
I am retrieving username from database and want to allow both English and Japanese cultures' username in my text box that displays username.
How to do it?

There is a property call ImeMode for text box which is by default "No control" which allow you to enter both English and Japanese
There is also other options like Hiragana,katagana,Alpha etc...
And regarding question of comparing string there is no need to worry about it is work with Unicode so it will compare both English and Japanese text.

Related

I'm working on a desktop application to manage a bibliotheque

I want to create a datagridview to accept value in Arabic and display this values in text box in C#.
Here is a example of when i try to enter values in Arabic:

Using Winforms, how can I insert the value of a masked textbox into a database? [duplicate]

I have a MaskedTextBox with this mask (999) 999 9999.
When user inputs a number the text property would give this to me :
(0881) 444 5445
But I want to save the raw text to database field like this: 08814445445.
How can I do that?
Based on what I found here you can set the TextMaskFormat-Property to MaskFormat.ExcludePromptAndLiterals. That should be you solution.
The MaskFormat-Enumeration holds some "options" for the MaskedTextBox.
They are:
ExcludePromptAndLiterals Return only text input by the user.
IncludeLiterals Return text input by the user as well as any literal characters defined in the mask.
IncludePrompt Return text input by the user as well as any instances of the prompt character.
IncludePromptAndLiterals Return text input by the user as well as any literal characters defined in the mask and any instances of the prompt character.
The default is
IncludeLiterals
It's Work for me
Just Change Property Value
Try setting the maskedTextBox.TextMaskFormat property to
MaskFormat.ExcludePromptAndLiterals

C# textbox with mixed Western and Arabic text

I would like to display mixed western & arabic data read from a file into a text box.
An example of the data is I want to display is:
"You have", "يوجد لديك"
I read the data in as follows:
String tsIn = File.ReadAllText(tbxTSFileName.Text, Encoding.UTF8);
tbxBefore.Text = tsIn;
I cannot see any properties that let me set the textbox to "mixed" encoding.
When I open the file in Notepad++ I select Encoding>Character sets>Arabic>ISO 8859-6.
To make matters even more complicated, I would want to use the same textbox for other languages too, so the solution needs to work in all/most cases.
You need to show us the assignment to the textbox - for instance, is this a WinForms textbox, a WPF textbox or an HTML textbox.
Strings in C# are unicode - so can definitely hold Arabic.
You are reading UTF8 format which supports Arabic so I cannot tell what your actual problem is. Your tsIn could easily contain Arabic - is your problem that you cannot see Arabic in your WinForms TextBox ? This link has a lot of detail on displaying arabic on WinForms
Winforms Arabic Input text box

How to do currency-based number validation?

I have a Winforms Application, in which I have a Combo Box, and a text box. Combo box has Currency symbols as follows:
USD
GBP
CAD
AUD
JPY
EUR
ISK
PLZ
TRL
etc ..
The user first selects one currency symbol from the above, and then types in a value in a text box, such as, $32.50, etc ..
I need to validate the string that he types into the text box, based on the currency he selected in the Combo Box. Each currency has its own way of writing money values.
For example, if the user selects USD then all of these typed strings shouble be reported as valid:
223.3
2244.44
$3,754.24
However if the user selects TRL (Turkish Lira), in which symbol is placed after the numeric value (to its right), then these should be valid:
223.3
2244.44
3,754.24 TL
How can I achieve this kind of validation ?
Since you already know the selected language, the easiest solution would be to not validate the symbol. Place an empty label on each side of the textbox and assign them according to the selected currency's symbol. Now you only have to worry about the decimal part, which is quite easy.

How to display Chinese characters in ListView?

maybe anyone have ideas of how to display Chinese characters in the ListView control ?
Ensure you have Chinese character capabilities on your actual machine and browser:
http://www.jp41.com/internet-explorer/chinese/
If you've done that and it's still a problem, perhaps you are getting data from a database that has been input as Chinese, but the data type on the relevant column isn't Unicode. In which case make change the data type to for example, nvarchar.

Categories