Hello all,
As a newbie in C# I am searching numerous forums and tutorial to do my reading and learning. I was also searching for a solutin for Login by a separate form and found on this forum a tread from May 14th 2010 called : Enabling and disabling a form.
The only thing in my form is that I have more than 1 control I want to enable of disable and that I want to start my login form from the main form by a button.
At this moment I have to log in triple maybe because I have 3 enable lines and my loginform start before my main form.
[edit] Just found out it is not effected by the 3 enable lines..[/edit]
Is there someone who can help me to let the forms open in the right order form me and to let me log in just once? Many thanks!
Think the trick is in my main form in the load void.
public bool MainControl = false;
LoginForm form2;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OpenPhone.Enabled = false;
OpenLog.Enabled = false;
emailToolStripMenuItem.Enabled = false;
form2 = new LoginForm(this);
form2.ShowDialog();
if (MainControl)
{
OpenPhone.Enabled = true;
OpenLog.Enabled = true;
emailToolStripMenuItem.Enabled = true;
}
}
private void loginbutton_Click(object sender, EventArgs e)
{
// opening login form
// some code to write...
}