468,754 Members | 1,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,754 developers. It's quick & easy.

Displaying a unicode character

Hi,
I'm just trying to do something very simple, but I can't find a simple
example. In a TextBox and Button on a WinForm, I just want to display some
Unicode characters -- specifically, U+2660, U+2663, U+2665 and U+2666 (the
playing card symbols).

It's my understanding that all strings is .NET are unicode strings. Is that
correct?

Currently I have the unicode characters as input to some strings:
E.g.

string s = "*♣♥♦"; // weird, this text box doesn't recognize the diamond
symbol

Then, I simply want to display those characters in a textbox:

textBox1.AppendText(s);

So, what other steps along the way do I need to do?

Thanks,
Nov 22 '05 #1
2 2548
Quimbly <Qu*****@discussions.microsoft.com> wrote:
I'm just trying to do something very simple, but I can't find a simple
example. In a TextBox and Button on a WinForm, I just want to display some
Unicode characters -- specifically, U+2660, U+2663, U+2665 and U+2666 (the
playing card symbols).

It's my understanding that all strings is .NET are unicode strings. Is that
correct?

Currently I have the unicode characters as input to some strings:
E.g.

string s = "????"; // weird, this text box doesn't recognize the diamond
symbol

Then, I simply want to display those characters in a textbox:

textBox1.AppendText(s);

So, what other steps along the way do I need to do?


Set the font to one which supports those symbols. You might want to use
CharMap to work that out.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 22 '05 #2
> string s = "*♣♥♦";
Try string s = "\u2660\u2663\u2665\u2666";
The strings are Unicode, but your source file is not.

--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by S. | last post: by
6 posts views Thread by Jonas | last post: by
13 posts views Thread by Toms | last post: by
7 posts views Thread by 7stud | last post: by
5 posts views Thread by tushar.saxena | last post: by
3 posts views Thread by gregpinero | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.