How to set Font Size in code?

Hi,

I am new to C# and have been searching for a simple way to set the Font Size for a textbox control. When I try to set it in the class constructor I'm told it is a read-only property.

I've looked thru many help topics but can't find a clear answer.

TIA,
Karl


Answer this question

How to set Font Size in code?

  • befstrat

    Thanks, that worked.

    I also found similar instructions under the Help for "Rich Textbox" control.

  • AZ_KD

    Fontsize is ReadOnly property but you can change Font Structure with similar code

    textBox1.Font = new Font(textBox1.Font.FontFamily.Name, 12.4);



  • How to set Font Size in code?