.NET Controlling 2nd form?
Hey, I'm just wondering how I can make it so that upon clicking a button it opens my
"Form2.h" and sets the value of "atomname" to "Hydrogen" I know there must be a way, but I have no idea. I know I could create 1 form for every one, but that would be about 170 forms, which would... suck.
Here's my code for a button click, help on how to make it do what I asked would be great =D
:
private: System::Void hydrogen_Click(System::Object^ sender, System::EventArgs^ e) {
Form2^ newform2 = gcnew Form2;
newform2->ShowDialog();
Re: .NET Controlling 2nd form?
You'd just need to make the atomname member (whatever its type may be...) of Form2 public. Then you can assign it whatever value you want between instantiation of the form with gcnew and displaying it with ShowDialog().
Aside from that, this is a C++/CLI issue and here is the wrong forum section to post it. The correct one is http://www.codeguru.com/forum/forumdisplay.php?f=17. So if the above doesn't solve your problem, please post further questions over there.
And please use code tags when posting code.
Re: .NET Controlling 2nd form?
Sorry bout' the wrong section. But thanks for the answer, my periodic table is working beautifully with the public vars!