0

Hello, I've worked on Console Apps. For a while and am moving to visual C++. I am working on a form right now and am stuck.

What I want to do is if the user prushes a button, it will display the text contained by that button to a label.

E.G label1->Text = button1->Text

I can do what I want to do in pascal so I'll show an example of what exactly I want to do.

string A, B;

begin
Label1.Caption := A + B
end

If you understand what I'm trying to do, could you please help me in completing this in C++?

Thanks in advance.

2
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by Raven11
0

Sorry for double post, can't find the edit button :/

Anyways, I'm tyring this right now:

System::String * str1;
System::String * str2;

label1->Text = str1 += str2;

and Get this error:

c:\Documents and Settings\Raven\Desktop\Work\Calculator\Form1.h(98): error C2297: '+=' : illegal, right operand has type 'System::String __gc *'

Am I on the right track?

0

Provide a little detail as to how far you've gotten with your code so far. Basically, you are going to respond to that windows WM_LBUTTONDOWN event. Then you can use GetWindowText (hWnd, lpstr String, length of string), provided window was created with "BUTTON" class.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.