1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HELP with C++ - Forms Application

Discussion in 'C++' started by miklavcicmatic, Jun 7, 2007.

  1. miklavcicmatic

    miklavcicmatic New Member

    Joined:
    Jun 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hello!
    I am a newbie in C++ so do not laugh if i ask something n00bish...
    Ok here is my problem:
    I have Form1 and Form2.
    On Form1 there is a Button named Button1.

    #include "Form2"
    Form2->Show; -->ERROR!

    When i click that button i want the Form2 to show. :confused:
    I've tryed but i can't figure it out. PLZ HELP...
    P.S.- I am veary good at VB if that helps...
    Other functions in cpp - i'll manage. :D
    Any Tutorial or sample code will be usefull..



    ------------------------------------------------
    Matic Miklavčič, 15y old, From Slovenia
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    1
    Trophy Points:
    0
    In Button's Click event handler you have to create an object of Form2 and then call the DoModal Function. (I am assuming you are on Windows Platform.)
     
  3. miklavcicmatic

    miklavcicmatic New Member

    Joined:
    Jun 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Yes, i am on windows. Can u please make a sample code???
    It would be veary useful.
    Thanks!;)
     
  4. miklavcicmatic

    miklavcicmatic New Member

    Joined:
    Jun 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    :) :) Yo man! I figure it out!!!!!!!!:) :)
    Code:
    private: System::Windows::Forms::Form^  Form2;
    this->Form2 = (gcnew System::Windows::Forms::Form());
    
    
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    				 this->Form2->Show();
    }
    LOL an easy code....
    Thanks for a hint! Bye.

    Mickey a.k.a. Matic
     
  5. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    1
    Trophy Points:
    0

Share This Page