Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple fonts within a line in a TextBox

Status
Not open for further replies.

philrock

Programmer
Jan 29, 2004
109
US
I'm writing a VB app for doing gear (toothed wheel) calculations. The user inputs many numbers, the program crunches the numbers and gives the user back still more numbers. But it's very easy to input numbers that can not result in meaningful calculations, so I want to generate an error report to give the user information as to what he needs to change, or what rules he has broken.

The list of errors can be long, so I plan to use a TextBox or a RichTextBox. I would like to be able to embed the "greater than or equal to" and "less than or equal to" symbols into strings.

The default font for the control will be Courier New, and I'm thinking of using the Symbol font for the special characters. I understand that the "greater than or equal to" symbol is Chr(242) in the Symbol font.

How would I create the string:

BigNum >= LittleNum

- where BigNum and LittleNum are both text strings in the Courier New font, and replacing >= with the "greater than or equal to" symbol in the Symbol font?

This is something that will happen at run time - I'm not trying to enable the user to do editing or formatting.
 
I see that Courier New also has [≤] and [≥] characters. If those 2 are all you'll need it may be as easy as:
Code:
        txtFormula.Text = "LitleNum " & Char.ConvertFromUtf32(8804) & " BigNum" 'Less Than or Equal
' and
        txtFormula.Text = "BigNum " & Char.ConvertFromUtf32(8805) & " LittleNum" 'Greater Than or Equal
 
That is cool.
Dave, how'd you figure out the 8804/8805 codes?
I see in Character Map where those symbols are Unicode 2264 and 2265 for Courier New... making both a difference of 6540, but I'm not sure if that's relevant.
 
2264 and 2265 are hex, 8804 and 8805 are the decimal equivalents!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top