Index of clicked ToolStripMenuItem

Posted on 2008-06-18
Last Modified: 2011-10-03
How to know the index of clicked ToolStripMenuItem
Question by:tetoo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 19

Accepted Solution

Stephen Manderson earned 150 total points
ID: 21817984
There isn't an index property on the toolstrip item click, however you could include the index in the tag property of each of the tool strip items and call the following to find what the tag (Containing the index)

I would wait to see what other suggestions people have though.


    Private Sub ToolStrip1_ItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked
    End Sub

Open in new window


Assisted Solution

Bruce_1975 earned 150 total points
ID: 21822862
It's a litte bit tricky to get it.
I tried it with ToolStripButton, but should work also for other ToolStripItem derevates.

private void MyCallBack(object sender, EventArgs e)
    ToolStripItem item = sender as ToolStripItem;
    int index = item.Owner.Items.IndexOf(item)

Open in new window


Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question