Archived

This topic is now archived and is closed to further replies.

C++.NET and Forms

This topic is 5112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am trying to display a form in C++ .NET but I just cannot get it working. How do you do it? I have tried this: SomeFormName* Form1 = new SomeFormName(); Form1::Show(); Whats matter with that?

Share this post


Link to post
Share on other sites
quote:
Original post by rob64464
Don't work


Oh yeah it does. What error messages are you getting?
Remember to #include the new form's header to any module you're using it in; omitting that step would be the first thing that could go wrong here...

-Nik

[edited by - Nik02 on December 15, 2003 1:05:43 PM]

Share this post


Link to post
Share on other sites
#using
#using
#using
#using

using namespace System;
using namespace System::ComponentModel;
using namespace System::Drawing;
using namespace System::Windows::Forms;

// Inherit from Form
__gc class MyForm : public Form
{
public:
MyForm();
}

public MyForm::MyForm()
{
// Set the window caption
Text = "My New Windows Form";

// Set the window size
ClientSize = System::Drawing::Size( 300, 485 );
}

int __stdcall WinMain()
{
// Starts the application thread displaying your form
Application::Run( new MyForm() );
return 0;
}

Share this post


Link to post
Share on other sites