Click here to Skip to main content
15,908,013 members
Home / Discussions / C#
   

C#

 
QuestionDeep copy and shallow copy with List<> [modified] Pin
jeffb427-Feb-07 10:51
jeffb427-Feb-07 10:51 
QuestionCheck for an existing item in a treeview Pin
sharpiesharpie7-Feb-07 9:43
sharpiesharpie7-Feb-07 9:43 
AnswerRe: Check for an existing item in a treeview Pin
led mike7-Feb-07 9:48
led mike7-Feb-07 9:48 
GeneralRe: Check for an existing item in a treeview Pin
sharpiesharpie7-Feb-07 9:51
sharpiesharpie7-Feb-07 9:51 
AnswerRe: Check for an existing item in a treeview Pin
PIEBALDconsult7-Feb-07 10:00
mvePIEBALDconsult7-Feb-07 10:00 
GeneralRe: Check for an existing item in a treeview Pin
sharpiesharpie8-Feb-07 1:25
sharpiesharpie8-Feb-07 1:25 
AnswerRe: Check for an existing item in a treeview Pin
Ravi Bhavnani7-Feb-07 11:13
professionalRavi Bhavnani7-Feb-07 11:13 
AnswerRe: Check for an existing item in a treeview Pin
Abisodun7-Feb-07 13:53
Abisodun7-Feb-07 13:53 
What you tried fails because treeView1.Nodes includes only the root nodes of the treeview. i.e. not the children of the root nodes.

One way is to recursively check for the item:

if (!NodePresent(treeView1.Nodes, mb))
{
//do your stuff
}

private bool NodePresent(TreeNodeCollection Nodes, TreeNode node)
{
if (Nodes.Contains(node))
return true;

foreach (Treenode treeNode in Nodes)
{
if(IsFolder(treeNode) && NodePresent(treeNode.Nodes, node))
return true;
}
return false;
}

private bool IsFolder(TreeNode node)
{
// Use the image index, node.Nodes.Count or a method of your choosing to determine whether child nodes may be present
}

Good Luck!
Questionhow to szie the window? Pin
Khoramdin7-Feb-07 9:33
Khoramdin7-Feb-07 9:33 
AnswerRe: how to szie the window? Pin
sharpiesharpie7-Feb-07 9:46
sharpiesharpie7-Feb-07 9:46 
AnswerRe: how to szie the window? Pin
Ravi Bhavnani7-Feb-07 11:20
professionalRavi Bhavnani7-Feb-07 11:20 
QuestionDecoding Attachment from rfc822? Pin
Eddymvp7-Feb-07 8:57
Eddymvp7-Feb-07 8:57 
AnswerRe: Decoding Attachment from rfc822? Pin
Guffa7-Feb-07 9:03
Guffa7-Feb-07 9:03 
GeneralRe: Decoding Attachment from rfc822? Pin
Eddymvp7-Feb-07 10:04
Eddymvp7-Feb-07 10:04 
AnswerRe: Decoding Attachment from rfc822? Pin
Guffa8-Feb-07 3:13
Guffa8-Feb-07 3:13 
QuestionHow to Browse , select a file and store it onto the txtbox Pin
Eyungwah7-Feb-07 8:22
Eyungwah7-Feb-07 8:22 
AnswerRe: How to Browse , select a file and store it onto the txtbox Pin
Ravi Bhavnani7-Feb-07 8:30
professionalRavi Bhavnani7-Feb-07 8:30 
AnswerRe: How to Browse , select a file and store it onto the txtbox Pin
Stefan Troschuetz7-Feb-07 8:30
Stefan Troschuetz7-Feb-07 8:30 
QuestionRe: How to Browse , select a file and store it onto the txtbox [modified] Pin
Eyungwah7-Feb-07 10:44
Eyungwah7-Feb-07 10:44 
AnswerRe: How to Browse , select a file and store it onto the txtbox Pin
Ravi Bhavnani7-Feb-07 11:23
professionalRavi Bhavnani7-Feb-07 11:23 
QuestionDragging a ToolStrip to a different panel... Pin
Shy Agam7-Feb-07 7:59
Shy Agam7-Feb-07 7:59 
QuestionDataGrid Pin
The Brazilian One7-Feb-07 7:47
The Brazilian One7-Feb-07 7:47 
AnswerRe: DataGrid Pin
Not Active7-Feb-07 8:29
mentorNot Active7-Feb-07 8:29 
AnswerRe: DataGrid Pin
Pete O'Hanlon7-Feb-07 8:41
mvePete O'Hanlon7-Feb-07 8:41 
Questiononly one instance from my app Pin
hadad7-Feb-07 7:32
hadad7-Feb-07 7:32 

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.