Click here to Skip to main content
15,793,609 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:
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();

              εισαγωγήToolStripMenuItem.Items.Enabled = false;


how i can do this???
Updated 2-May-12 15:12pm

Share this answer
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.
VJ Reddy 4-May-12 13:00pm    
Succinct and to the point. 5!
Sergey Alexandrovich Kryukov 4-May-12 13:08pm    
Thank you, VJ.
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)
MenuForm form = new MenuForm();

3. show form again on closed or exit application

protected override void OnClosed(EventArgs e)

Share this answer
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