1.

Solve : VB 2008 MenuStripItem?

Answer»

I have a project that I added a MenuStrip too. 1 of my menu items is SUPPOSED to make a label hide or display.
Originally this is my code ( which does work, just not quite the way I want)
LabelToolStripMenuItem.Checked = NOT(LabelToolStripMenuItem.Checked)
MessageLabel.Visible = LabelToolStripMenuItem.Checked

Now this does work but it will close the Menu upon checking the menu item. I am TRYING to get it to STAY open so I can check or uncheck without have to go back into the Menu, make sense?

I have tried
If LabelToolStripMenuItem.Checked then
MessageLabel.Visible = True
Else
LabelToolStripMenuItem.Checked = False
End if


its not working(

Tour

'ifs are overkill, but for the record you've got it backwards:


Code: [SELECT]If Not LabelToolStripMenuItem.Checked then
MessageLabel.Visible = True
Else
LabelToolStripMenuItem.Checked = False
End if

but, you can just as easily do this:



Code: [Select]LabelToolStripMenuItem.Checked = Not LabelToolStripMenuItem.Checked




Thanks)
I think I will leave as this:

LabelToolStripMenuItem.Checked = NOT(LabelToolStripMenuItem.Checked)
MessageLabel.Visible = LabelToolStripMenuItem.Checked

It works so why mess with it? HEHE good call, didn't see the visible property call there; thought they were both checked calls.



Discussion

No Comment Found