We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,240 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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'
3
Contributors
3
Replies
2 Hours
Discussion Span
1 Year Ago
Last Updated
5
Views
juss2022
Newbie Poster
1 post since Feb 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

Ancient Dragon
Achieved Level 70
Team Colleague
32,139 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,576
Skill Endorsements: 69

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

gazzatav
Newbie Poster
10 posts since May 2009
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0

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
Achieved Level 70
Team Colleague
32,139 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,576
Skill Endorsements: 69

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1449 seconds using 2.7MB