Change the Font of a control

Cecilia

Member
Joined
Aug 14, 2007
Messages
24
Programming Experience
Beginner
I need to set the Font of a GroupBox the same as the value set in a TextBox in another form, the value in the TextBox might change anytime. But I was always told that the Font is read only. Is that any way to dynamically set the Font of the GroupBox?

Thanks!
 
The Font property is not ReadOnly. People often use the wrong terminology. What is true is that a Font object is immutable. That means that once you create a Font object you cannot change it. That means that you cannot access a Font object from a control's Font property and change any of its properties. What you must do is create a new Font object and assign that to the control's Font property.
 
Back
Top