Hi

I am new in VB. I have writen simple code

Private sub cmdBotton_Click()
txtbox.font.size = 12
End Sub

then i got error message that "property 'Size' is 'ReadOnly'"

I would appreciate if you could help me with this

ilgar

Member Avatar for Dukane

That's because that method only returns the size of the font for the textbox, you cannot set it that way.

To change the font size, you need to create a new font object and then assign it to the Font property. For example:

Dim newFont as New Font("Tahoma", 18, FontStyle.Bold)
TextBox1.Font = newFont

Thanks a lot Dukane.

Thanks for Daniweb too. I had few questions and people are really helpfull here. Great forum

ILGAR

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.