Hi, i'm trying to use the treeview to display the text of a rtf (rich text file) file when an specific node if clicked.
Home
OMG
WOOT
For example, if i pick OMG, i want the text of lol.rtf to be displayed on a richtextbox. But somehow i just can't manage to get it... I know to import the text of a .txt file to a textbox, but using the treeview makes it more complicated.
This is the code im using right now:
Code:
Private Sub TreeView1_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
Select Case e.Node.Index
Case 0
Dim file As String
file = My.Computer.FileSystem.ReadAllText(filename)
RichTextBox1.Text = file
Case 1
'Same code, different file name
Case 2
'Same code, different file name
Case 3
'Same code, different file name
Case 4
'Same code, different file name
End Select
End Sub
Another thing is, that i can't import the *.rtf text into a richtextbox and i don't know why.