Form designer won’t allow you to add new classes before the main form class. In fact you can place a class before the forms main class no problem for the compiler – its just the form editor that won’t have it (you can’t view the form in design view)

To solve this you need to move the class to a seperate header file and include it with all the other includes. This solves the problem. Spent ages trying to define the class, functions etc before the form to get round the problem but whatever you do it causes an error. Get over it and just create a small header file. Whatever your doing would probably be well suited to turning it into a class anyway!!

In the seperate file

namespace {
	public ref class InstallerUpdaterClass
	{
		void InstallerUpdaterClass::UpdaterStartSilent(void)
		{
			try
			{
				//Pause before starting
				Thread::Sleep(10000);		//mS

				String ^UpdaterFilename;
				UpdaterFilename = Path::GetDirectoryName(Application::ExecutablePath);
				UpdaterFilename += "\\" + INSTALLER_UPDATER_FILENAME;

				Process ^UpdaterProcess = Process::Start(UpdaterFilename, "/silent");
				UpdaterProcess->Close();
			}
			catch (Exception ^)
			{
			}
		}
	};
}
In the form you can now use this no problem

	MyNamespace::InstallerUpdaterClass::UpdaterStartSilent()
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.