Hi,

I am trying to add onClick events to the different menu items in the menu strip... However, I am not sure how I should do about this...

Let say if I have two top menu option: "Option1" and "Option2",
each of them has a sub menu item called "Item1"...

If I want to have a form for Option1 -> Item1 and another for Option2->Item1, what should I do?

Thanks.

Recommended Answers

All 2 Replies

I'm assuming you dragged a MenuStrip from the toolbox and have filled in the desired items.
Now doubleclick the area where you typed Item1.
You will get somethig like this:

private void item1ToolStripMenuItem_Click(object sender, EventArgs e)
    {

    }  

Do the same for your Item2 item.
Now fill in whatever you like to do whenever Item1 or Item2 is selected when you run your program.

Thanks. I am able to add the necessary triggers in my codes. Thanks :)

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.