Setting Textbox to Bold

W

Wayne Wengert

I am trying to set the text in a textbox to Bold but I keep getting an error
that 'Bold" is ReadOnly? My code is as follows:

Dim N As New Form1()



If CheckBox1.Checked = True Then

N.TextBox1.Font.Bold = True

End If
 
J

Jem

The Font object is immutable, i.e. you cannot change it's properties
individually. You can however create a new Font object that is the same in
all other respects as the existing one and assign it to the Font property.
If you keep switching between the two, you may wish to cache the two
objects.

Jem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top