Jump to content
  • Advertisement

Archived

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

rob64464

C++.NET and Forms

This topic is 5325 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
Advertisement
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
Doh, Pity it didn''t show the:

#using <mscorlib.dll>
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

Properly

Share this post


Link to post
Share on other sites
#include "SomeFormName.h"

Put that on top of the form1.h file.
That way, the form1 module can "see what the other form looks like".

Kind rgds,
-Nik

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!