VC++ Forms call forms

srfpala 111 Reputation points
2021-01-03T00:47:23.217+00:00

I have a Windows CppCLR_Winforms App built with VS2019 running in Win10.
Using C++/CLR Windows Forms for Visual Studio 2019 (by Kaiser )
Has anyone been able to create a windows form (frmMain) with a button that when clicked
displays another windows form ( Form2) ?
Seems so simple, but I still fail eventhough others have kindly attempted to help.
TIA
srfpala

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,891 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,729 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 85,136 Reputation points
    2021-01-03T09:31:30.22+00:00

    I don't use any extension and this basic code works normally for me :

    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
    {
        CLR_Test::MyForm2^ form2;
        form2 = (gcnew CLR_Test::MyForm2());
        form2->Show();       
    }
    

    Create-Form.gif

    0 comments No comments

  2. srfpala 111 Reputation points
    2021-01-03T21:24:05.437+00:00

    WOW WOW WOW
    It worked as expected.
    And I used the C++/CLR Windows Forms for Visual Studio 2019 Extension
    Thank you so much.
    srfpala

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.