I'm putting in an admin form that will provide variable information, into my application. How can I Password Protect that child form?

Thanks,
Hendo

I'm putting in an admin form that will provide variable information, into my application. How can I Password Protect that child form?

Thanks,
Hendo

Okay, I have the password thing working. However, once I put in the password, the application should bring up another child window. Here's the set up....

In my application, I have a menu item called options. When you click on Options, the drop down gives me "Administrator" and "Exit". When I click on "Administrator", I go to a child form to type in a password. Upon entering a valid password, the child form should close, and the child form "options" should now be viewed.

What's happening is that when a correct password is entered, that child form closes, but the "Admin Options" child form does not come up. If I click back up on the "Options >> Administrator" menus, then it comes up.

It should come up directly after the correct password is entered. Here's the relevant code:
[parent form code]

if (Globalvar.pcheck == "y")
            {
                AdminForm newMDIChild = new AdminForm();
                newMDIChild.MdiParent = this;
                newMDIChild.Show();
            }
            if (Globalvar.pcheck == "n")
            {
                LogInScreen newMDIChild = new LogInScreen();
                newMDIChild.MdiParent = this;
                newMDIChild.Show();
            }

[login screen code]

if (PWtbox.Text == "xxxxxxxx")
            {
                Globalvar.pcheck = "y";
                this.Close();

            }
            else if (PWtbox.Text == "")
            {
                MessageBox.Show("Please Enter Your Password...");
            }
            else
            {
                MessageBox.Show("Password is INCORRECT!");
            }

You just need to swap the order of the test in your main form.

if (Globalvar.pcheck == "n")
            {
                LogInScreen newMDIChild = new LogInScreen();
                newMDIChild.MdiParent = this;
                newMDIChild.Show();
            }
            if (Globalvar.pcheck == "y")
            {
                AdminForm newMDIChild = new AdminForm();
                newMDIChild.MdiParent = this;
                newMDIChild.Show();
            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.