Here is a possible solution:
You need 2 forms:
- MainForm (IsMdiContainer = True)
- LogonForm (optionally: ControlBox = False; FormBorderStyle = FixedSingle; MaximizeBox = False)
In the LogonForm create a method that checks the validity of the credentials passed. If the credentials are good, set the DialogResult of the form to OK.
this.DialogResult = DialogResult.OK;
In the Program.cs set the following:
static void Main()
LogonForm frm = new LogonForm();
DialogResult result = frm.ShowDialog();
if (result == DialogResult.OK)
This way, your logonform is first opened and only if the user entered valid credentials, the mainform (mdi) is opened.