Click here to Skip to main content
15,881,516 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: datagridviewtextboxcell error on 350 characters Pin
Eddy Vluggen22-Nov-14 3:55
professionalEddy Vluggen22-Nov-14 3:55 
GeneralRe: datagridviewtextboxcell error on 350 characters Pin
Rhyde Marsh24-Nov-14 2:36
Rhyde Marsh24-Nov-14 2:36 
GeneralRe: datagridviewtextboxcell error on 350 characters Pin
Eddy Vluggen24-Nov-14 3:38
professionalEddy Vluggen24-Nov-14 3:38 
GeneralRe: datagridviewtextboxcell error on 350 characters Pin
Rhyde Marsh10-Dec-14 3:44
Rhyde Marsh10-Dec-14 3:44 
QuestionChart Control Legend Item Ordering Pin
Member 998046316-Oct-14 2:40
Member 998046316-Oct-14 2:40 
AnswerRe: Chart Control Legend Item Ordering Pin
jkirkerx17-Nov-14 13:38
professionaljkirkerx17-Nov-14 13:38 
Questioninfragistics numeric editor+ alllow user to input the value max Pin
srinandan..16-Sep-14 21:00
srinandan..16-Sep-14 21:00 
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
Member 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
Member 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
Member 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
Member 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
Member 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
Member 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
Eric P Schneider28-Jan-19 11:03 
QuestionClosing a dropdown box on a toolstrip item Pin
Member 980468925-Aug-14 6:42
Member 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
Member 980468927-Aug-14 5:02 

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.