Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Guys.
I'm having some difficulty getting my ToolStripMenuItem objects visible. Basically, I have a MenuStrip which is on an MDI parent form. On the File DropDownList there is another DDL called "Close Views...". On that DDL I have five generic tsmItems which have their Visible property set to False. Here's the primary code:
VB
Dim menuItem As ToolStripMenuItem = Nothing
Dim itemList As ToolStripItemCollection = Me.tsmCloseViews.DropDownItems()
For Each tsmObj As Object In itemList
    menuItem = TryCast(tsmObj, ToolStripMenuItem)
    If menuItem.Tag = "(Open)" Then
        With menuItem
            .Tag = NewForm.Name
            .Text = "Close " & FormText
            .GetCurrentParent.Visible = True
            .Visible = True
            .Available = True
        End With
        Exit For
    End If
Next


I suspect that the modifiers on the tsmItems need to be set to Protected or some other little setting that I am overlooking.

Any input would be appreciated!

What I have tried:

As shown in the above code, I have tried several methods which are described in various posts on the internet.
Posted
Updated 6-Dec-18 3:49am

1 solution

Well, I'm not entirely sure why, but moving the code out of the module and into the Main class where the MenuStrip was contained solved the problem.

I guess we'll consider this one closed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900