Hi
I am new to programming and to the c# syntax. Can someone explain to me what this refers to in the snippet of code below
using System;
using System.Windows.Forms;
class MyTestButtonClass : Form
{
private Button myButton;
// Constructor method
public MyTestButtonClass()
{
myButton = new Button();
myButton.Text = "Click me";
this.Controls.Add(myButton);
}
// Main method
static void Main()
{
Application.Run(new MyTestButtonClass());
}
}
Is this a new Form or is this a new instance of the MyButtonClass or if I am totally off the point can someone explain the code to me. I would have thought that the following bit of code
Application.Run(new MyTestButtonClass());
should be made outside of the class definition??? Thanks in advance for all your help