Solved

how to call a ToolStripMenuItem from a control collection

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Name Space error VS2015 1 36
VB.net Excel VSTO Add-in version compatability 2 15
"lblTime is not declared" 3 31
Create a button class for use in all vb.net apps 5 17
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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