Click here to Skip to main content
14,972,741 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: infragistics numeric editor+ alllow user to input the value max Pin
Eddy Vluggen19-Sep-14 8:19
professionalEddy Vluggen19-Sep-14 8:19 
Questionsearch or filter treenode display based on text input from user Pin
Member 110597994-Sep-14 13:27
MemberMember 110597994-Sep-14 13:27 
AnswerRe: search or filter treenode display based on text input from user Pin
Richard MacCutchan4-Sep-14 21:17
mveRichard MacCutchan4-Sep-14 21:17 
GeneralRe: search or filter treenode display based on text input from user Pin
Member 110597995-Sep-14 2:46
MemberMember 110597995-Sep-14 2:46 
GeneralRe: search or filter treenode display based on text input from user Pin
Richard MacCutchan5-Sep-14 3:26
mveRichard MacCutchan5-Sep-14 3:26 
GeneralRe: search or filter treenode display based on text input from user Pin
Member 110597995-Sep-14 10:50
MemberMember 110597995-Sep-14 10:50 
GeneralRe: search or filter treenode display based on text input from user Pin
Richard MacCutchan5-Sep-14 21:08
mveRichard MacCutchan5-Sep-14 21:08 
GeneralRe: search or filter treenode display based on text input from user Pin
Member 110597996-Sep-14 4:09
MemberMember 110597996-Sep-14 4:09 
Okay. I got my answer from a respondent on MSDN. Since I'm in the process of learning the language, syntax, and nuances of Visual C# this is the kind of answer struggling people like me hope to receive from FORUMS like this. There is no way I would have known to do this or "Write It" without guidance.

Quote:
Hi Hawk73ku,

According to your description, you'd like to find the specified treenode from the TreeView.

I wrote a sample for you, Here are my steps.

Step1: create a form with a textbox, a button and a treeview.

Step2: set the button click event handler like this.
List<treenode> tnlist = new List<treenode>();//collect the result nodes
int count = -1;//used to record the index of the selectnode

private void button1_Click(object sender, EventArgs e)
{
this.treeView1.Focus();
tnlist.Clear();
this.getallTreeNode(this.treeView1.Nodes, tnlist);
if (tnlist != null && tnlist.Count > 0)
{
count++;
if (count >= tnlist.Count)
{
count = 0;
}
this.treeView1.SelectedNode = tnlist[count];
}
}
private void getallTreeNode(TreeNodeCollection nodes, List<treenode> ltn)
{
foreach (TreeNode tn in nodes)
{
if (tn.Text.ToLower().Contains(this.textBox1.Text.ToLower()))
{
ltn.Add(tn);
}
if (tn.Nodes.Count > 0)
getallTreeNode(tn.Nodes, ltn);
}
}



the getallTreeNode method in my code is used to collect the result treenodes to a list.

Results:



#TreeNode Class
http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode(v=vs.110).aspx

If you have any other concern regarding this issue, please feel free to let me know.

Best regards,

Youjun Tang

GeneralRe: search or filter treenode display based on text input from user Pin
Richard MacCutchan6-Sep-14 5:02
mveRichard MacCutchan6-Sep-14 5:02 
GeneralRe: search or filter treenode display based on text input from user Pin
Member 110597998-Sep-14 4:13
MemberMember 110597998-Sep-14 4:13 
GeneralRe: search or filter treenode display based on text input from user Pin
Richard MacCutchan8-Sep-14 5:01
mveRichard MacCutchan8-Sep-14 5:01 
AnswerRe: search or filter treenode display based on text input from user Pin
Eddy Vluggen5-Sep-14 2:57
professionalEddy Vluggen5-Sep-14 2:57 
GeneralRe: search or filter treenode display based on text input from user Pin
Member 110597995-Sep-14 10:47
MemberMember 110597995-Sep-14 10:47 
AnswerRe: search or filter treenode display based on text input from user Pin
Eddy Vluggen8-Sep-14 8:35
professionalEddy Vluggen8-Sep-14 8:35 
GeneralRe: search or filter treenode display based on text input from user Pin
Eric P Schneider28-Jan-19 11:03
MemberEric P Schneider28-Jan-19 11:03 
QuestionClosing a dropdown box on a toolstrip item Pin
Member 980468925-Aug-14 6:42
MemberMember 980468925-Aug-14 6:42 
AnswerRe: Closing a dropdown box on a toolstrip item Pin
Ravi Bhavnani25-Aug-14 8:47
professionalRavi Bhavnani25-Aug-14 8:47 
GeneralRe: Closing a dropdown box on a toolstrip item Pin
Member 980468927-Aug-14 5:02
MemberMember 980468927-Aug-14 5:02 
GeneralRe: Closing a dropdown box on a toolstrip item Pin
Member 980468927-Aug-14 5:09
MemberMember 980468927-Aug-14 5:09 
GeneralRe: Closing a dropdown box on a toolstrip item Pin
Ravi Bhavnani27-Aug-14 5:43
professionalRavi Bhavnani27-Aug-14 5:43 
AnswerRe: Closing a dropdown box on a toolstrip item Pin
xstoneheartx25-Dec-14 13:34
Memberxstoneheartx25-Dec-14 13:34 
QuestionC# Error Config file Pin
Member 856781222-Aug-14 20:55
MemberMember 856781222-Aug-14 20:55 
AnswerRe: C# Error Config file Pin
Richard MacCutchan22-Aug-14 21:13
mveRichard MacCutchan22-Aug-14 21:13 
GeneralRe: C# Error Config file Pin
Member 856781222-Aug-14 22:38
MemberMember 856781222-Aug-14 22:38 
GeneralRe: C# Error Config file Pin
Richard MacCutchan23-Aug-14 0:14
mveRichard MacCutchan23-Aug-14 0:14 

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.