Solved

how to call a ToolStripMenuItem from a control collection

Posted on 2013-01-23
2
450 Views
Last Modified: 2013-01-27
Hi

Is there a way to call a toolstripmenuitem from a control collection???

for example I have a toostripmenuitem named "test"

"test" is located in the contextmenustrip "testmenu"

it is possible to call it like this?????:

if me.controls("test").name = "hello" then
........
endif

Open in new window

0
Comment
Question by:altariamx2003
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 38811790
No.  ContextMenuStrips work differently than a regular container (like a Form or Panel).

A ContextMenuStrip has an Items() collection, containing ToolStripItem instances (not instance of Control).

Thus you'd have to do:
        Dim tsi As ToolStripItem = testmenu.Items("test")
        If Not IsNothing(tsi) Then
            MessageBox.Show(tsi.Text)
        End If

Open in new window

0
 

Author Closing Comment

by:altariamx2003
ID: 38824644
thanks!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now