You can add an event handler to the
NodeMouseClicked[
^] event in the tree view (go to the events of the tree view by selecting the events tab (the one with the lightning bolt) in the property window, find the event you want, then double click in the white space to add the handler).
Then, in that handler you can use the Stream objects, like
StreamReader[
^] to read in the contents of the file and place it in the RichTextBox by using the .Text property or .AppendText() method.
If you are using Windows Forms (not WPF)
here is a good tutorial on loading files into a RichTextBox[
^]
[Edit]
In the main form Constructor, add:
treeView1.NodeMouseClicked += new TreeNodeMouseClickEventHandler(treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e);
Then, in the form .cs file, add the following function:
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
string fileName = e.Node.Text;
richTextbox1.LoadFile(fileName, RichTextBoxStreamType.RichText);
}
There is no need to try to pass "messages" like c/c++ did, and the .NET RichTextBox doesn't support loading files through messages like that. The above code is simple and works very well, don't over-complicate things because thats how they were done "the old way".