Converting Console App to Winform app

  • Thread starter Thread starter Madalin Nicula
  • Start date Start date
M

Madalin Nicula

Hi
I have a console app which works fine and I want to convert it to a WinForm
app.Can anyone help me how to do it?
 
Madalin Nicula said:
I have a console app which works fine and I want to convert it to a
WinForm app.Can anyone help me how to do it?

You can change the project type in the project properties dialog.
 
You also need to inherit your class from the 'System.Windows.Forms.Form'
class which will automatically activate Form Designer support (very nice
detail).
Remember to add a reference to the System.Windows.Forms dll.

This is the minimum code for a Windows Application:

--- Code --------------------------------
using System;
using System.Windows.Forms;

namespace MyNamespace
{
class MyClass : System.Windows.Forms.Form
{
[STAThread]
static void Main()
{
Application.Run( new MyClass() );
}
}
}
------------------------------------------

(To show what you created in the Form Designer you need to call
InitializeComponent() from the class constructor)

good luck, Teis
 
Back
Top