views:

476

answers:

5

I write windows application using C# and .NET2.0. In RichTextBox I would like to show Celsius symbol. How to do it? Is it possible?

+5  A: 

Do you mean Celsius symbol as in 37°C? If so you can simply put that character where it should be, I guess:

 richTextBox.Text = string.Format("{0}°C", degrees);

If you are looking for character codes (or just want to find character to copy/paste them), you can use the Character Map application in Windows (in Start -> Programs -> Accessories -> System Tools).

Fredrik Mörk
Yes - I mean degree symbol. Thanks
mykhaylo
+1  A: 

richTextBox1.Text = "°" will display a degree symbol in a rich textbox but I'm pretty sure you want something else. Please rephrase your question if that's the case.

Julien Lebosquain
Celsius symbol - I mean degree symbol ;)
mykhaylo
+2  A: 

Do you mean °C? You get ° from the keyboard as ALT + 0176 on the numeric keypad.

Mike Two
Yes, I mean degree symbol. Thanks
mykhaylo
+2  A: 

If you are wary of embedding a non-ASCII character in your source code, you could use the following instead:

richTextBox.Text = string.Format("{0}\u00B0C", degrees);

(B0 is the hexadecimal for 176.)

binarycoder
A: 
° //html entity.
Elzo Valugi