Link to home
Start Free TrialLog in
Avatar of alexa102398
alexa102398

asked on

Superscripts / Subscripts in VB Labels/Textbox

With a sciebtific VB project I need to use super/sub scripts and othe scientific notation in both labels and text boxes user entries eg H20 or 3 squared or cubed or 10 to the power of 6 as well as Degrees etc
Avatar of Dr. Kamal Mehdi
Dr. Kamal Mehdi
Flag of Greece image

Unfortunately, VB controls that have a Font property does not allow you to set the font as Superscript or Subscript.
A possible solution is that you print every character the user enters in a text box, you print it on a picture box with the appropriate font size and position. This however involves a lot of work in code to take into consideration the cases where the user deletes a character after typing it, etc.

Regards
Avatar of alexa102398
alexa102398

ASKER

Thanks Ka,a;;
Nothing wrong with the answer and it clarifies our thoughts but would like to know if there is any other alternative to that suggested by kamall
ASKER CERTIFIED SOLUTION
Avatar of ameba
ameba
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I know this will not work for all containers.
For textboxes you must use RichTextBox.
I think this might now give us a solution to the problem.
Thanks
You will have to check also:
 ctl.Container.Visible=True ' this will allow using tabstrip control
You can also add a little colour (e.g. blue for superscript, red for subscript)
Just set "ctl.Container.ForeColor" at 3 places.