Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    57
    Thanks
    11
    Thanked 0 Times in 0 Posts

    RichTextBox.text to Listview

    Each line of text in RichTextBox1 needs to be added to Listview2. How can i achieve this?

    My Code that adds all text in one line

    Dim str() As String = kiword.RichTextBox1.Text.Split(CChar(vbNewLine))
    Dim i As Integer = 0
    Do
    kiword.ListView2.Items.Add(str(i))
    i += 1
    Loop Until i = str.Count
    Last edited by kor81; 08-10-2012 at 06:24 PM.

  • #2
    New Coder
    Join Date
    Aug 2011
    Posts
    57
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by kor81 View Post
    Each line of text in RichTextBox1 needs to be added to Listview2. How can i achieve this?

    My Code that adds all text in one line
    Still haven't figured this out

  • #3
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,711
    Thanks
    41
    Thanked 191 Times in 190 Posts
    form consists of three objects: a button, a listview, and a richtextbox

    Code:
    Public Class Form1
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim demo As String() = RichTextBox1.Text.Split(CChar(vbNewLine))
    
            For Each s As String In demo
                Dim lItem As New ListViewItem(s)
                ListView1.Items.Add(lItem)
            Next
    
    
        End Sub
    End Class

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

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