?
Solved

treeview with richtextbox

Posted on 2004-09-27
10
Medium Priority
?
610 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Industry Leaders: 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!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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