Reputation: 1712
Its kinda dummy question, but how to pass variable from one button click function to another? lets say I have
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
string x;
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
passWord(y);
}
and I want to pass variable x to function passWord(y) which launches when I click button3.
Any ideas?
Upvotes: 2
Views: 599
Reputation: 2655
well there are many ways to do it. one method is define a class member, such as
String ^ x = "some text";
then you can use this string in both button event handlers
Upvotes: 1