Click here to Skip to main content
15,921,577 members
Home / Discussions / C#
   

C#

 
GeneralRe: Bind Binary data to Gridview Pin
Mycroft Holmes29-Jul-10 22:14
professionalMycroft Holmes29-Jul-10 22:14 
GeneralRe: Bind Binary data to Gridview Pin
SatyaKeerthi1529-Jul-10 23:55
SatyaKeerthi1529-Jul-10 23:55 
QuestionPublishing Update problem Pin
kbalias29-Jul-10 19:40
kbalias29-Jul-10 19:40 
AnswerRe: Publishing Update problem Pin
Richard MacCutchan29-Jul-10 22:36
mveRichard MacCutchan29-Jul-10 22:36 
QuestionHow to add multiple components (texboxes,compoboxbutton etc...) to a listview Pin
aneesh kumar k29-Jul-10 18:32
aneesh kumar k29-Jul-10 18:32 
AnswerRe: How to add multiple components (texboxes,compoboxbutton etc...) to a listview Pin
Mycroft Holmes29-Jul-10 20:55
professionalMycroft Holmes29-Jul-10 20:55 
AnswerRe: How to add multiple components (texboxes,compoboxbutton etc...) to a listview Pin
Gonzalo Cao29-Jul-10 23:53
Gonzalo Cao29-Jul-10 23:53 
QuestionToggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Matt U.29-Jul-10 16:53
Matt U.29-Jul-10 16:53 
Hi, fellow CodeProject members. Smile | :) I'm writing an application that contains a menu strip and a tool strip. The main application window is an MDI Container and on the left-hand side of the window is a splitter with a TreeView control. Depending on the TreeView's selected node I would like to enable/disable certain tool strip and menu strip items. What is the best way to go about doing so?

I currently do something like this:

private void mainTreeView_AfterSelect(object sender, TreeViewEventArgs e)
{
    if (mainTreeView.SelectedNode == null) return;    // No selection

    TreeNode selectedNode = mainTreeView.SelectedNode;

    switch (selectedNode.Level)
    {
        case 0:    // Root node
            // Toggle the 'Enabled' state of eight items total (combination of ToolStrip and MenuStrip items)
            // ...
            break;
        case 1:    // Child node (only goes Root->Child at the moment; may expand allowed depth later on but not right now)
            if (selectedNode.Parent.Name == "RootNode1")
            {
                // Toggle items based on child of RootNode1
                // ...
            }
            else if (selectedNode.Parent.Name == "RootNode2")
            {
                // Toggle items differently from RootNode1
                // ...
            }
            break;
    }
}
}


There are currently eight items total for which I would like to toggle depending on the TreeView selection. I am only wanting to toggle the 'Enabled' state for the items. That's because, for example, root node 1 is selected so the user can only select "New Item...". Or if a child of root node 1 is selected then the user can choose "New Item...", "Edit Item..." or "Delete Item...". And root node 2 holds a different type of item so root node 1 items shouldn't be enabled in that case.

Is there a different way to go about this altogether? Do I have it all (or partially) incorrect? Or should I simply create a method for each case, such as "void ToggleRootNodeItems(int OneOrTwo)" and "void ToggleChildNodeItems(int ParentIsRootOneOrTwo)"?

I hope I explained my question fully. If you need more information I can provide you with whatever you need. Thanks much!
AnswerRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Jimmanuel30-Jul-10 3:31
Jimmanuel30-Jul-10 3:31 
GeneralRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Matt U.30-Jul-10 8:42
Matt U.30-Jul-10 8:42 
GeneralRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Matt U.30-Jul-10 12:03
Matt U.30-Jul-10 12:03 
GeneralRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Jimmanuel31-Jul-10 6:39
Jimmanuel31-Jul-10 6:39 
QuestionNHibernate CreateSqlQuery and addEntity Pin
Matt Cavanagh29-Jul-10 16:22
Matt Cavanagh29-Jul-10 16:22 
QuestionUsing RasGetEntryProperties in .NET CF Pin
notsotragichero29-Jul-10 9:49
notsotragichero29-Jul-10 9:49 
QuestiondatagridView1_CellContentClick Problem Pin
MumbleB29-Jul-10 6:27
MumbleB29-Jul-10 6:27 
AnswerRe: datagridView1_CellContentClick Problem Pin
I Believe In GOD29-Jul-10 6:56
I Believe In GOD29-Jul-10 6:56 
GeneralRe: datagridView1_CellContentClick Problem Pin
MumbleB29-Jul-10 7:05
MumbleB29-Jul-10 7:05 
AnswerRe: datagridView1_CellContentClick Problem Pin
Mycroft Holmes29-Jul-10 17:21
professionalMycroft Holmes29-Jul-10 17:21 
GeneralRe: datagridView1_CellContentClick Problem Pin
MumbleB4-Aug-10 2:39
MumbleB4-Aug-10 2:39 
QuestionProblem with pc to pc Voice chat on LAN using h323 protocol. Pin
88Rocker29-Jul-10 5:46
88Rocker29-Jul-10 5:46 
AnswerReason for my vote of 1 Pin
OriginalGriff29-Jul-10 6:04
mveOriginalGriff29-Jul-10 6:04 
QuestionGive .NET Compiled Assemblly DLL StrongName Pin
I Believe In GOD29-Jul-10 5:33
I Believe In GOD29-Jul-10 5:33 
AnswerRe: Give .NET Compiled Assemblly DLL StrongName Pin
Ennis Ray Lynch, Jr.29-Jul-10 5:35
Ennis Ray Lynch, Jr.29-Jul-10 5:35 
GeneralRe: Give .NET Compiled Assemblly DLL StrongName Pin
I Believe In GOD29-Jul-10 5:54
I Believe In GOD29-Jul-10 5:54 
GeneralRe: Give .NET Compiled Assemblly DLL StrongName Pin
Nagy Vilmos29-Jul-10 5:59
professionalNagy Vilmos29-Jul-10 5:59 

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.