Solved

how to call a ToolStripMenuItem from a control collection

Posted on 2013-01-23
2
455 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
[X]
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
2 Comments
 
LVL 86

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

752 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