Link to home
Create AccountLog in
Avatar of vbturbo
vbturboFlag for Denmark

asked on

character code for cubic meter

Hi

what is the char code for m3 ?

Char chr  = Keys.Alt And Keys(252);
or
Char chr  = Alt+252;

i need to present  e.g 2.34 m3 into a label

pls see attached image

thanks

vbturbo

m3.gif
Avatar of skronk
skronk

ALT + 0179 = ³
³ or ³

?

Maby i am missunderstanding the question :)

http://www.tntluoma.com/sidebars/codes/
The Unicode character code for a superscript 3 is: 0xb3.

You can find character codes using Charmap.exe (Character Map). You'll find the unicode for the selected character presented in bottom left of the window.

Code sample is shown using two different ways to utilise the character code. You should also be able to directly include the character in your code.
decimal vol = 2.34m;
 
// Option 1
label1.Text = string.Format("{0} m{1}", vol, Convert.ToChar(0xB3));
 
// Option 2
label1.Text = string.Format("{0} m\u00B3", vol);

Open in new window

SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of vbturbo

ASKER

Hi

thanks for reply

im not trying to catch any key events i just want to concat a string with m3

this only gives me " chr = 2 "
{
    string chr = ((char)(char)(string)(Forms.Keys.Alt + 179)).ToString();
}

ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of vbturbo

ASKER

Thank you both for input

skronkDate - your code did the job