Label text setting in MSVC++.NET

Hi. I amverynew 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++.
[292 byte] By [thedigitalpioneer] at [2007-12-16]
# 1
Hi,

try this:

label1->Text = "test";

rgerbig at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2
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);
thedigitalpioneer at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3
Come on, doesn't somebody know? What does the designer do that I don't?
thedigitalpioneer at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 4
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!!

TheDigitalPioneer at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 5
Hi,
you have to convert your strings to ins#ts:
int.Parse(txtnum1->text);
rgerbig at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 6
Uhhhh, could you elaborate on that? I can't quite figure out what to do. I am getting more errors when I try that than I did before. I am obviously doing something wrong. As usual.Smile
Thanks,
The Digital Pioneer
TheDigitalPioneer at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...