954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C++ change textBox font size with a NumericUpDown.

Hello everybody.

I've a question.
I tried to change font size of textBox named "textBox1"

Here is the function of the NumericUpDown:

private: System::Void numericUpDown2_ValueChanged(System::Object^  sender, System::EventArgs^  e) 
		 {
			 String^ Num2 = this->numericUpDown2->Text;
			 this->textBox1->Font->Size = Num2;
		 };


Errors that occur:

error C2039: 'set' : is not a member of 'System::Drawing::Font::Size'
error C2039: 'set' : is not a member of 'System::Drawing::Font::Size'
juss2022
Newbie Poster
1 post since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

Size is read-only meaning you can't change its value.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Num2 is a String, is Font->Size an int or double?

gazzatav
Newbie Poster
7 posts since May 2009
Reputation Points: 10
Solved Threads: 1
 

Google for "System::Drawing::Font::Size" and you will find out what it is. Size returns a float. You can not use it to set the font size.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: