Results 1 to 7 of 7

Thread: [RESOLVED] How to save the Richtextbox lines into a listbox?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    294

    Resolved [RESOLVED] How to save the Richtextbox lines into a listbox?

    I have a Richtextbox.Text in my project and I need to save all text lines into a ListBox.Text .

    Can you help me please?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to save the Richtextbox lines into a listbox?

    The Text of both controls is not relevant. The RTB has a Lines property, which returns a String array. The ListBox has a DataSource property and an Items.AddRange method, both of which will accept a String array.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    294

    Re: How to save the Richtextbox lines into a listbox?

    My problem is that my app make search on google en extract the urls into the richtextbox but I want navigate to this sites and I need save these URLs into a listbox. I need to transfer the urls from the richtextbox to the listbox.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to save the Richtextbox lines into a listbox?

    And I told you how it could be done. Now you just have to do it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    294

    Re: How to save the Richtextbox lines into a listbox?

    Thank you very much

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2011
    Posts
    294

    Re: [RESOLVED] How to save the Richtextbox lines into a listbox?

    Sorry but I have problem with that I only getting the first lines (items).

    Code:
    Private Sub addlist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addlist.Click
            Dim NewArray() As String = RichTextBox1.Text.Split(vbNewLine)
            For Each item As String In NewArray
                ListBox1.Items.Add(item)
            Next
            RichTextBox1.Text = ""
        End Sub
    Can you help me?

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] How to save the Richtextbox lines into a listbox?

    I already did help, but you apparently ignored it. There's not much point my posting the same thing again.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width