Solved

treeview with richtextbox

Posted on 2004-09-27
10
541 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now