Click here to Skip to main content
15,894,307 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
Dear honors,

How to Set superscript and subscript characters in textbox or label .net
Posted
Updated 26-Dec-18 4:38am

Superscript in windows based application ?
i think textbox will support only plain char's. take help of Richtextbox.
 
Share this answer
 
Comments
Member 8323919 22-Jan-17 17:03pm    
This is not true, Text box will display whatever you send to it, eg. sq meters can be diplayed as m² by simply Texbox1.Text = "10 m²"
koolprasad2003 23-Jan-17 1:30am    
As I said textbox will support only plain char's. you need to take help of Richtextbox, (using OFFSET property you can show superscript or subscript)
Look into this post[^] for a simple tip to use the Superscript and Subscript in VB.NET
 
Share this answer
 
Your solution in the middle of this page.
 
Share this answer
 
v2
try this, it gives your solution:

C#
<asp:label runat="server" text="s<sup>arv</sup><sub>esh</sub>" xmlns:asp="#unknown"></asp:label>
 
Share this answer
 
v2
Comments
drveera 23-Dec-11 2:32am    
Hi friend.. I want in windows application...
Found a quicker solution here : Superscript Text In Names Of Lables And Buttons - VB.NET | Dream.In.Code[^]

Goto Start->Programs->Accessories->System tools->Character Map
Now select this Character ² from the Characters listed.
Click Select
Click Copy
    
Then try to change the text of any control by pasting this Character. Is should work.
    
I wrote the following code and it did display the Superscript '²' on the button.
     Button1.Text = "mm ²"
 
Share this answer
 
Comments
Dave Kreskowiak 26-Dec-18 10:42am    
First, this was asked and answered seven years ago.

Next, you copied a character glyph that happens to look like a superscript 2. That doesn't give you the ability to set any text you want in the textbox to superscript using this method.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900