Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys!

i have two forms: a login form and a menu form and i want when i log in with different user to hide items from menu form
i try this but it doesnt work:
C#
private void button1_Click(object sender, EventArgs e)
      {
          if (username_txth.Text == username && password_txth.Text == password)
          {
              MessageBox.Show("You are now logedin as admin");
              Menu myNewForm = new Menu();

              myNewForm.Show();
              this.Hide();
              εισαγωγήToolStripMenuItem.Items.Enabled = false;

          }


how i can do this???
Posted
Updated 2-May-12 14:12pm
v2

 
Share this answer
 
Comments
lalaou 2-May-12 21:00pm    
i try
εισαγωγήToolStripMenuItem.Visible = false;
but i have an error: The name 'εισαγωγήToolStripMenuItem' does not exist in the current context
Sergey Alexandrovich Kryukov 3-May-12 13:18pm    
Well, look where this name is defined and what is that access; how can I know that? and I would highly recommend you name everything in English, regardless of your culture.
--SA
VJ Reddy 4-May-12 13:00pm    
Succinct and to the point. 5!
Sergey Alexandrovich Kryukov 4-May-12 13:08pm    
Thank you, VJ.
--SA
first you need, username_txth.Equals(username)
using == means they are the same object, not that the strings are the same value

to show the form again need to pass the Owner (this)
C#
MenuForm form = new MenuForm();
            form.Show(this);
            this.Hide();


3. show form again on closed or exit application

C#
protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            this.Owner.Show();
        }


cheers
 
Share this answer
 
Comments
lalaou 2-May-12 20:54pm    
thx for answering!
my problem is not the forms! i want to hide some menu strip items for each user and i dont know how i can do this!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900