.NET Controlling 2nd form?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: .NET Controlling 2nd form?

Hybrid View

  1. #1
    Join Date
    Sep 2011
    Posts
    5

    Question .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();

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,583

    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.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Sep 2011
    Posts
    5

    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!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center