To elaborate on Abhinav's answer, you need to create a Property in your form with the DataGridView that holds your node value. In the Setter for the property you could call a method that filters your results and rebinds the DataGridView. Something like this :
private string nodeValue;
public string NodeValue
{
get
{
return nodeValue;
}
set
{
if (nodeValue != value)
{
nodeValue = value;
NodeValueChanged(value);
}
}
}
public frmDataGridView(string nodeValue)
{
this.NodeValue = nodeValue;
}
void NodeValueChanged(string newNodeValue)
{
}
Then in your form with the TreView you need to create a private variable that references your GridView form, then whenever the treeview selection changes, in the treeview selection changed event you just need to change the property like this:
private frmDataGridView gridView;
public frmTreeView()
{
gridView = new frmDataGridView();
gridView.NodeValue = "DefaultValue";
}
void TreeViewChanged(object sender, TreeViewChangedEventArgs e)
{
gridView.NodeValue = "Selected TreeView Value";
}
Hope this helps.
Disclaimer. This code has not been checked, the TreeViewChanged event I have used is fictitious, so you need to use the proper TreeView changed event.