Solved

treeview with richtextbox

Posted on 2004-09-27
10
565 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scanning dentists xray (the small ones) 3 54
Allow User To Arrange Columns At Datagridview 3 26
Exit the loop 4 42
VB.NET (2008) - Refactoring Question 2 21
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

772 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