Home > Enterprise >  How to display exponent in a label?
How to display exponent in a label?

Time:09-22

I'm looking for a possibility to write a label text for cubic meters where the 3 is written as an exponent to m. For example:

mylabel.Text="m3";

Is it possible to write the 3 as an exponent? How should I do it?

CodePudding user response:

I don't think there is a exact or proper way of doing this. But one way you can do this is by entering the digit that you want to be a exponent into this website https://lingojam.com/SuperscriptGenerator.

And then copy the converted version. So for your example I put a 3 in there, and the converted version I got was ³. Then you just connect it together.

Now you can just add it to the label...

mylabel.Text="m³";

CodePudding user response:

Something like

mylabel.Text = "m"   "\u00B3";

CodePudding user response:

You don't have to escape your Unicode characters in strings as C# is inherently Unicode. Just put your Unicode characters as they are into the string. For example:

mylabel.Text = "m³";
  • Related