Solved

how to call a ToolStripMenuItem from a control collection

Posted on 2013-01-23
2
448 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
Comment Utility
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
Comment Utility
thanks!!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

8 Experts available now in Live!

Get 1:1 Help Now