Windows Develop Bookmark and Share   
 index > Windows Forms General > Display ANSI characters?
 

Display ANSI characters?

I'm wondering how I can display ANSI characters in a windows form label through code.
You know, stuff like this: •�· ° © ™�

Thanks
maguidhir  Thursday, October 26, 2006 10:16 PM

Since .NET is Unicode you would have to use the Unicode characters. For example the following string will give something like the text you have posted:

string t = "\u25cf\u2022\u00b0\u00a9\u2122"

\u followed by 4 hexadecimal digits generates an Unicode character with the specified hexadecimal code. One simple way to find these codes is to use the Charater Map tool that comes with every version of Windows.

Mike Danes  Friday, October 27, 2006 7:58 AM

where are you obtaining the characters from? If you are obtaining it from a file for example, you need to adjust the encoding used to read the file, displaying it in the UI Control, such as a label, should be ok but its down to the encoding I believe.

ahmedilyas  Thursday, October 26, 2006 10:28 PM

Since .NET is Unicode you would have to use the Unicode characters. For example the following string will give something like the text you have posted:

string t = "\u25cf\u2022\u00b0\u00a9\u2122"

\u followed by 4 hexadecimal digits generates an Unicode character with the specified hexadecimal code. One simple way to find these codes is to use the Charater Map tool that comes with every version of Windows.

Mike Danes  Friday, October 27, 2006 7:58 AM

You can use google to search for other answers

Custom Search

More Threads

• Progress Bar
• Degree Conversion Application
• Problem with Text Propert of TextBox Control
• Stupid question about changing controls
• How to refer to current form?
• how to make the form grow dynamically based on the number of records.
• Focus in textBox
• Label Mnemonic Custom Handling
• Displaying Time From Two Countries
• set statusbar text