Click here to Skip to main content
16,005,206 members
Home / Discussions / C#
   

C#

 
AnswerRe: How can I have access to an arraylist Pin
George L. Jackson21-Nov-06 23:54
George L. Jackson21-Nov-06 23:54 
GeneralRe: How can I have access to an arraylist Pin
Schmullus22-Nov-06 0:23
Schmullus22-Nov-06 0:23 
GeneralRe: How can I have access to an arraylist Pin
Russell Jones22-Nov-06 0:44
Russell Jones22-Nov-06 0:44 
GeneralRe: How can I have access to an arraylist Pin
Schmullus22-Nov-06 5:19
Schmullus22-Nov-06 5:19 
AnswerRe: How can I have access to an arraylist Pin
bes200522-Nov-06 0:30
bes200522-Nov-06 0:30 
QuestionControlling the focus in WindowsForms Pin
Dobromir Dimitrov21-Nov-06 23:32
Dobromir Dimitrov21-Nov-06 23:32 
QuestionContext menu on a TreeView Pin
Sonu.T21-Nov-06 23:25
Sonu.T21-Nov-06 23:25 
AnswerRe: Context menu on a TreeView Pin
Schmullus22-Nov-06 0:09
Schmullus22-Nov-06 0:09 
Hi,

have a look to my example:

I created a windows-application with a form
and one 'TreeView'-component named treeView1 in my code.
The only code is written within the Load-event of the form:

        <br />
        private void Form1_Load(object sender, EventArgs e)<br />
        {<br />
            ContextMenu myRootContextMenu = new ContextMenu();<br />
            myRootContextMenu.MenuItems.Add("Edit Root");<br />
<br />
            ContextMenu myChild1ContextMenu = new ContextMenu();<br />
            myChild1ContextMenu.MenuItems.Add("Edit Child 1");<br />
            ContextMenu myChild2ContextMenu = new ContextMenu();<br />
            myChild2ContextMenu.MenuItems.Add("Edit Child 2");<br />
<br />
<br />
            TreeNode rootTreeNode = new TreeNode("Root");<br />
            rootTreeNode.ContextMenu = myRootContextMenu;<br />
            rootTreeNode.Nodes.Add("First Node");<br />
            rootTreeNode.Nodes[0].ContextMenu = myChild1ContextMenu;<br />
            rootTreeNode.Nodes.Add("Second Node");<br />
            rootTreeNode.Nodes[1].ContextMenu = myChild2ContextMenu;<br />
<br />
            treeView1.Nodes.Add(rootTreeNode);<br />
        }<br />


I created one root treenode 'rootTreeNode'
TreeNode rootTreeNode = new TreeNode("Root");

and
added two child nodes:
rootTreeNode.Nodes.Add("First Node");<br />
rootTreeNode.Nodes.Add("Second Node");


After that, I added this treenode to the TreeView 'treeView1'
of the Form.
treeView1.Nodes.Add(rootTreeNode);

Now we come to the context-menues:
I created one root context-menu, and gave it a description

ContextMenu myRootContextMenu = new ContextMenu();<br />
myRootContextMenu.MenuItems.Add("Edit Root");


and with the property 'ContextMenu' of the rootTreeNode

rootTreeNode.ContextMenu = myRootContextMenu;

I made the assignment.

The context-menues for the child nodes are

ContextMenu myChild1ContextMenu = new ContextMenu();<br />
myChild1ContextMenu.MenuItems.Add("Edit Child 1");<br />
ContextMenu myChild2ContextMenu = new ContextMenu();<br />
myChild2ContextMenu.MenuItems.Add("Edit Child 2");



and assigned in the same way.


Hope this helps a little bit

Regards

Erik
Questionexchange data between db2 (as400) and ms sql server Pin
amilapradeep21-Nov-06 22:43
amilapradeep21-Nov-06 22:43 
AnswerRe: exchange data between db2 (as400) and ms sql server Pin
Mridang Agarwalla22-Nov-06 5:10
Mridang Agarwalla22-Nov-06 5:10 
QuestionDrawImage to Bitmap? Pin
s4_sabahatf21-Nov-06 22:40
s4_sabahatf21-Nov-06 22:40 
AnswerRe: DrawImage to Bitmap? Pin
Eduard Keilholz21-Nov-06 22:49
Eduard Keilholz21-Nov-06 22:49 
GeneralRe: DrawImage to Bitmap? Pin
s4_sabahatf21-Nov-06 23:00
s4_sabahatf21-Nov-06 23:00 
GeneralRe: DrawImage to Bitmap? Pin
Guffa21-Nov-06 23:25
Guffa21-Nov-06 23:25 
QuestionLimit the number of simultaneous logins Pin
Shree21-Nov-06 22:12
Shree21-Nov-06 22:12 
AnswerRe: Limit the number of simultaneous logins Pin
rah_sin22-Nov-06 0:21
professionalrah_sin22-Nov-06 0:21 
Questionproblem with forms' invocation Pin
kumar.bs21-Nov-06 22:01
kumar.bs21-Nov-06 22:01 
AnswerRe: problem with forms' invocation Pin
Eduard Keilholz21-Nov-06 22:09
Eduard Keilholz21-Nov-06 22:09 
GeneralRe: problem with forms' invocation Pin
kumar.bs21-Nov-06 22:24
kumar.bs21-Nov-06 22:24 
Questionapplicaion Exit problem... Pin
IamHuM21-Nov-06 21:49
IamHuM21-Nov-06 21:49 
AnswerRe: applicaion Exit problem... Pin
Eduard Keilholz21-Nov-06 21:54
Eduard Keilholz21-Nov-06 21:54 
AnswerRe: applicaion Exit problem... Pin
freshonlineMax21-Nov-06 22:12
freshonlineMax21-Nov-06 22:12 
QuestionSimple C# audio spectrum library Pin
Mihc21-Nov-06 21:39
Mihc21-Nov-06 21:39 
QuestionDataGridView : Get Checkbox Coumns Value Pin
freshonlineMax21-Nov-06 20:36
freshonlineMax21-Nov-06 20:36 
AnswerRe: DataGridView : Get Checkbox Coumns Value Pin
freshonlineMax21-Nov-06 22:09
freshonlineMax21-Nov-06 22:09 

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.