Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

treeview with richtextbox

Posted on 2004-09-27
10
Medium Priority
?
629 Views
Last Modified: 2012-06-27
i have a treeview with ten nodes

two rich text boxes    notes   and   newwork


want to click on a node and write text in notes from node1.txt , node2.txt, etc for that specific node

then enter text in newwork for that node

then save the whole thing so all work will be there next time and can be edited and expanded
0
Comment
Question by:aijohn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
10 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 12166662
Make an Class which has two Variables notes and  newwork of String type, attach this Object with the tag object of the nodes, On Focus of any node, populate the strings in the RichTextBoxes by picking the values from Tag object.

Now how to save a Tree you can see the following example
http://www.dotnetspider.com/Technology/KBPages/544.aspx
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12166669
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12166675
better examples for saving TreeView
http://www.thecodeproject.com/cs/miscctrl/loadandsave.asp
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:aijohn
ID: 12176317
nice examples, but I'm trying to get a specific answer on how to fill textboxes with input from text file
depending on which node is selected
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12176551
Please, I am so slow...

When you select a Node, you want to view its contents in a richTextBox?
0
 

Author Comment

by:aijohn
ID: 12176602
I want to view textfile1.txt when node1 selected
textfile2.txt when node2 selected, etc,, etc
in first text box


then i want to input new text for each node in the second textbox on same form

and then save the whole thing
0
 
LVL 18

Accepted Solution

by:
armoghan earned 2000 total points
ID: 12176707
This is how you can load a file line by line.

Dim file_name As String = DataFile()
        Dim stream_reader As New IO.StreamReader(file_name)
        Dim line As String

        ' Read the file one line at a time.
        line = stream_reader.ReadLine()
        Do While Not (line Is Nothing)
            ' Trim and make sure the line isn't blank.
            line = line.Trim()
            If line.Length > 0 Then _
                lstAnimals.Items.Add(line)

            ' Get the next line.
            line = stream_reader.ReadLine()
        Loop
        lstAnimals.SelectedIndex = 0
        stream_reader.Close()
/////////////////////////////


and this is how you determine which node is clicked by attaching a listener to the TreeView and finding the node on click

Private Sub TreeView1_MouseDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
TreeView1.MouseDown

Dim Node As System.Windows.Forms.TreeNode

If e.Button = MouseButtons.Left Then
Node = TreeView1.GetNodeAt(New System.Drawing.Point(e.X, e.Y))
If Not Node Is Nothing Then Debug.WriteLine(Node.Text)
End If

End Sub

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question