Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Index of clicked ToolStripMenuItem

Posted on 2008-06-18
4
Medium Priority
?
2,539 Views
Last Modified: 2011-10-03
How to know the index of clicked ToolStripMenuItem
0
Comment
Question by:tetoo
2 Comments
 
LVL 19

Accepted Solution

by:
Stephen Manderson earned 600 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.

Regards
Steve


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

Open in new window

0
 
LVL 6

Assisted Solution

by:Bruce_1975
Bruce_1975 earned 600 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.

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

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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…
Simple Linear Regression

876 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