Click here to Skip to main content
15,919,434 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threaded client server connection problems Pin
teknolog1234-Sep-10 5:07
teknolog1234-Sep-10 5:07 
GeneralRe: Threaded client server connection problems Pin
Ian Shlasko4-Sep-10 5:30
Ian Shlasko4-Sep-10 5:30 
QuestionCheck if File is in Use Pin
MumbleB3-Sep-10 1:42
MumbleB3-Sep-10 1:42 
AnswerRe: Check if File is in Use Pin
OriginalGriff3-Sep-10 1:59
mveOriginalGriff3-Sep-10 1:59 
AnswerRe: Check if File is in Use Pin
Dave Kreskowiak3-Sep-10 2:17
mveDave Kreskowiak3-Sep-10 2:17 
AnswerRe: Check if File is in Use Pin
Łukasz Nowakowski3-Sep-10 3:13
Łukasz Nowakowski3-Sep-10 3:13 
QuestionHow to access public varialbes in C# class Pin
Joe Rozario3-Sep-10 1:31
Joe Rozario3-Sep-10 1:31 
AnswerRe: How to access public varialbes in C# class Pin
#realJSOP3-Sep-10 1:34
professional#realJSOP3-Sep-10 1:34 
GeneralRe: How to access public varialbes in C# class Pin
Joe Rozario3-Sep-10 1:39
Joe Rozario3-Sep-10 1:39 
AnswerRe: How to access public varialbes in C# class Pin
AspDotNetDev3-Sep-10 11:50
protectorAspDotNetDev3-Sep-10 11:50 
GeneralRe: How to access public varialbes in C# class Pin
Ravi Bhavnani5-Sep-10 19:02
professionalRavi Bhavnani5-Sep-10 19:02 
AnswerRe: How to access public varialbes in C# class Pin
Pete O'Hanlon3-Sep-10 1:42
mvePete O'Hanlon3-Sep-10 1:42 
GeneralRe: How to access public varialbes in C# class Pin
Joe Rozario3-Sep-10 18:38
Joe Rozario3-Sep-10 18:38 
GeneralRe: How to access public varialbes in C# class Pin
Pete O'Hanlon3-Sep-10 21:43
mvePete O'Hanlon3-Sep-10 21:43 
QuestionAvoiding exceptions in socket programming Pin
Rob Philpott3-Sep-10 0:49
Rob Philpott3-Sep-10 0:49 
AnswerRe: Avoiding exceptions in socket programming Pin
Not Active3-Sep-10 1:06
mentorNot Active3-Sep-10 1:06 
GeneralRe: Avoiding exceptions in socket programming Pin
Rob Philpott3-Sep-10 1:10
Rob Philpott3-Sep-10 1:10 
GeneralRe: Avoiding exceptions in socket programming Pin
#realJSOP3-Sep-10 1:36
professional#realJSOP3-Sep-10 1:36 
AnswerRe: Avoiding exceptions in socket programming Pin
DaveyM693-Sep-10 1:35
professionalDaveyM693-Sep-10 1:35 
QuestionToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew2-Sep-10 17:53
AussieLew2-Sep-10 17:53 
AnswerRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
Matt U.2-Sep-10 17:59
Matt U.2-Sep-10 17:59 
GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew2-Sep-10 18:45
AussieLew2-Sep-10 18:45 
AnswerRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
DaveyM695-Sep-10 7:20
professionalDaveyM695-Sep-10 7:20 
This is the correct behaviour. As the parent menu item isn't visible, it is impossible for the child to be visible therefore setting the Visible property has no effect.

You should either:

1. Set the visibility of the higher items first.
2. Use the Enabled property instead. You could iterate over all the items and set Visible based on Enabled.

C#
private void SetMenuItemsVisiblity(MenuStrip menuStrip)
{
    foreach (ToolStripMenuItem item in menuStrip.Items)
    {
        item.Visible = item.Enabled;
        if (item.Visible && item.DropDownItems.Count > 0)
            SetToolStripMenuItemVisiblity(item);
    }
}
private void SetToolStripMenuItemVisiblity(ToolStripMenuItem item)
{
    foreach (ToolStripMenuItem subItem in item.DropDownItems)
    {
        subItem.Visible = subItem.Enabled;
        if (subItem.Visible && item.DropDownItems.Count > 0)
            SetToolStripMenuItemVisiblity(subItem);
    }
}

Dave

If this helped, please vote & accept answer!


Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew6-Sep-10 1:49
AussieLew6-Sep-10 1:49 
GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
DaveyM696-Sep-10 2:34
professionalDaveyM696-Sep-10 2:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.