Solved

how to call a ToolStripMenuItem from a control collection

Posted on 2013-01-23
2
451 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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 …
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 …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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