Friday, November 19, 2010

Visual Studio 2005 - Using Code to set items as bold/italic and change font size.?

I'm using visual studio 2005, i'm doing a project in college and fairly new to the program. i'm using visual basic language (no C,c++,java, ect)



I've been trying to set a command button and a textbox to be bold in font and change the size.



I need to do this in code as i have made a button to enable/disable bold and a numeric up/down to change the font size.

although i can get the values i want to display in a textbox.



eg i can get txt1.text to be = to int(numupdown.text)

i just don't seem to know how to get the font to bold, looking i found various things font.bold = true, font.bold seems to be read only.

any help would be great, been scratching my head for a while and my lecturer is also stumped!Visual Studio 2005 - Using Code to set items as bold/italic and change font size.?
You need to create a new font object and assign the whole thing to the textbox's font property like so:



TextBox1.Font = New System.Drawing.Font(TextBox1.Font, FontStyle.Bold)

No comments:

Post a Comment