Label text setting in MSVC++.NET
Hi. I am
verynew to MSVC++. I don't know anything really. I would like to know how to access the text property of a label (and all of the properties for that matter), and to edit it. I am used to VB.NET, where is is as simple as 'label1.text', but that didn't work with C++.
That did it. I am used to VB.NET, and the '.' just didn't cut it. I do have another question though:
I made a label in the code without using the designer (I created it as a variable), assigned text to it, gave it a location, but I can't get it to show up on the form during runtime. What did I do wrong? Here is my code:
System::Windows::Forms::Label myNewLabel;
myNewLabel.Text = "myNewLabel";
myNewLabel.Location = System::Drawing::Point(30,30);
OK, so nobody knows. Dissapointing.
I do have a question which I guarantee someone will know though. As I said before, I'm new to C++. My question is:
How do you set a property with a value straight from a variable? I have tried
int num1=txtnum1->text;
int num2=txtnum2->text;
int sum=num1+num2;
lblsum=sum;
and
(same variables)
lblsum=sum.ToString;
What did I do wrong? Everything was soooooooo much easier in VB!!