Articles in this section
Category / Section

How to perform search through the nodes in WinForms MultiColumnTreeView?

1 min read

Searching

In MultiColumnTreeView, we can perform searching through its nodes using the enum “TreeViewSeachOption”.

C#

//Search in MultiColumnTreeView
TreeViewSearchForm searchform;
this.multiColumnTreeView1.SelectionMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeSelectionMode.MultiSelectAll;
searchform = new TreeViewSearchForm(this.multiColumnTreeView1);
 
private void multiColumnTreeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
   if (e.Modifiers == Keys.Control && e.KeyValue == (Char)Keys.F)
   {
     searchform = new TreeViewSearchForm(this.multiColumnTreeView1);
     searchform.ShowDialog();
   }
}
//Search option
TreeViewFindReplaceDialog dialog = null;
dialog = new TreeViewFindReplaceDialog(this.TreeView);
dialog.Find("india", Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeViewSearchOption.MatchWholeText, TreeViewSearchRange.TreeView);
this.button2.Click += new System.EventHandler(this.button2_Click);
this.button1.Click += new System.EventHandler(this.button1_Click);
//Find 
private void button1_Click(object sender, EventArgs e)
{
   dialog.Find(this.findTextBox.Text);
}
//Find All
private void button2_Click(object sender, EventArgs e)
{
   dialog.FindAll(this.findTextBox.Text);
}

 

VB

'Search in MultiColumnTreeView
Private searchform As TreeViewSearchForm
Me.multiColumnTreeView1.SelectionMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeSelectionMode.MultiSelectAll
searchform = New TreeViewSearchForm(Me.multiColumnTreeView1)
  
Private Sub multiColumnTreeView1_PreviewKeyDown(ByVal sender As Object, ByVal e As PreviewKeyDownEventArgs) Handles multiColumnTreeView1.PreviewKeyDown
     If e.Modifiers = Keys.Control AndAlso e.KeyValue = CType(Keys.F, Char) Then
        searchform = New TreeViewSearchForm(Me.multiColumnTreeView1)
        searchform.ShowDialog()
     End If
 End Sub
'Search option
Private dialog As TreeViewFindReplaceDialog = Nothing
dialog = New TreeViewFindReplaceDialog(Me.TreeView)
dialog.Find("india", Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeViewSearchOption.MatchWholeText, TreeViewSearchRange.TreeView)
 AddHandler button2.Click, AddressOf button2_Click
 AddHandler button1.Click, AddressOf button1_Click
'Find 
 Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    dialog.Find(Me.findTextBox.Text)
 End Sub
'Find All
 Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs)
    dialog.FindAll(Me.findTextBox.Text)
 End Sub
 

 

Searching for the nodes in MultiColumnTreeView

Fig 1: Searching for the nodes in MultiColumnTreeView

Samples:

C#: How to perform search through the nodes in MultiColumnTreeView_C#?

VB: How to perform search through the nodes in MultiColumnTreeView_VB?

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied