

create a list of bool that will store the visible state I want the controls to have. I don't like the solution but that's the only way to make it work // get all sub menus The problem is them having Visible to false due to the way it works the parent set it's own Visible to false as well. To do so I was iterating on it's child and checking the Visible property.
Menustrip item visible cannot be changed code#
My main problem is that one menu visibility state was based on if all sub menus are not visible then it should not either. I had similar problem with menustrip, so I decided to use this: CODE Dim CertainItemName As String 'Menu1ToolStripMenuItem' For Each i As ToolStripMenuItem In MenuStrip1.Items If (i.Name CertainItemName) Then i.Visible (Not i.Visible) 'test only Exit For End If Next Hope this helps. It is still unavailable in the form_loaded event. There is some major issues here.Īs mentioned in the comments the property Visible getter does not reflect the actual inner property value until later in the lifecycle. Just tried to put visible = true in the designer.cs instead and in the form_load still tells me the value is false. I also tried with 4-5 other menu item in that window and they all show the same behavior. I recall seeing this issue in the past but cannot find anything about it. of a sorted column, the one with the arrow, might not change to the orange. When I put the breakpoint on the line in the form_load I clearly see it's false and if it let the line run the value is still false. in the OPT, visible whenever a scan is selected, move items around in a tree. So I decided to remove all my code and simply hardcode the set to true and to my surprise this does not work. I thought it be easy so I coded all the logic around and it failed. So in the form load I want to switch to the visible state to true. In the code above export is a menu item of type ToolStripMenuItem which trough the property grid in the form design mode I have modified it's Visible property to false. Private void MainBuilder_Load(object sender, EventArgs e) In the form code public partial class MainBuilder : Form

+= new System.EventHandler(this.mnuExport_Click) I cannot figure out what special thing had to be done to edit the ToolStripMenuItem control a Visible property while inside a form load. I have encounter that issue a long time ago and again now.
