G
Gustaf
My Windows app is dependant on some registry keys settings. In case the
subkey for the app doesn't exists, I want to show a messagebox, and then
quit the whole program (without showing the main form). How do you
accomplish this?
The program starts with:
[STAThread]
static void Main()
{
Application.Run(new frmMain());
}
In the frmMain() constructor I call a GetRegistryValues() method that
populates a set of class variables:
public frmMain()
{
// Get settings from Windows registry
bool b = GetRegistryValues();
if (b == false)
return;
// Draw the form
InitializeComponent();
...
GetRegistryValues() returns false if there was a problem. In that case,
I don't want to show frmMain at all. But when I run the code above, I
get an empty form of standard size, even if I return to Main() when
GetRegistryValues() has failed.
Gustaf
subkey for the app doesn't exists, I want to show a messagebox, and then
quit the whole program (without showing the main form). How do you
accomplish this?
The program starts with:
[STAThread]
static void Main()
{
Application.Run(new frmMain());
}
In the frmMain() constructor I call a GetRegistryValues() method that
populates a set of class variables:
public frmMain()
{
// Get settings from Windows registry
bool b = GetRegistryValues();
if (b == false)
return;
// Draw the form
InitializeComponent();
...
GetRegistryValues() returns false if there was a problem. In that case,
I don't want to show frmMain at all. But when I run the code above, I
get an empty form of standard size, even if I return to Main() when
GetRegistryValues() has failed.
Gustaf