Newbie Hello World question: Show in textbox on button click

J

J.S.

I can show Hello World in a MessageBox with this code:

private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {MessageBox::Show("Hello, World!");
}

but I cannot show it in a textbox with this code:

private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {textBox1::Show("Hello World");
}

I am using VC++ 2005 Express Edition beta.

I'd appreciate any pointers. It was so much easier to do in C#. :)

Thanks,
J.S.


--
 
J

James Park

J.S. said:
I can show Hello World in a MessageBox with this code:

private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {MessageBox::Show("Hello, World!");
}

but I cannot show it in a textbox with this code:

private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {textBox1::Show("Hello World");
}

I am using VC++ 2005 Express Edition beta.

I'd appreciate any pointers. It was so much easier to do in C#. :)

I think you want something like:
textBox1->Text = "Hello World";

If you're coming from C#, learn the ins and outs of the '::', '->', and '.'
operators.

The procedure should be the same regardless of language (assign a String to
the textBox's Text property) though. It shouldn't be much different in C#.

The MSDN library can tell you what members the .NET Framework controls
possess. You might want to search through it when the need arises.
 
J

J.S.

James Park said:
I think you want something like:
textBox1->Text = "Hello World";

Thanks, James! That worked just fine!

If you're coming from C#, learn the ins and outs of the '::', '->', and
'.' operators.

The procedure should be the same regardless of language (assign a String
to the textBox's Text property) though. It shouldn't be much different in
C#.

The MSDN library can tell you what members the .NET Framework controls
possess. You might want to search through it when the need arises.

Yes, that seems to be a great resource.

Thanks,
J.S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top