While moving some code around for investigation purposes, I came across a little feature of .NET that I was unaware of, which is that the form class must be the first class in a form module for the form designer to work. The following stops the designer from working:
public class myClass
{
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
...
}
It still compiles (with a warning) and runs, but it wont design. If I move myClass to the bottom of the file then it works fine. Does anyone know why this is the case?
Also, this implies that there's a set of rules to code layout within a form that I am unaware of. Is there a list of these somewhere that anyone knows of - or have I found the only one?