Live Chat Icon For mobile
Live Chat Icon

When I try to set a particular font style, say italics, I get an error message ‘Property cannot be assigned to — it is read only’. How can I set this read only property

Platform: WinForms| Category: Fonts

Code such as

	tabControl1.Font.Italic = true;

will not work. Instead, you have to create a new Font object, and set the property during its creation. This code will work.

	tabControl1.Font = new Font(tabControl1.Font, FontStyle.Italic);

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.