Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27333

VS 2010 combine two textboxes text into listbox

$
0
0
im trying to combine lists from two richtextboxes through a string builder then add it ti listbox
the problem is that with the final step , when i add result to listbox it add list to same line
any help to add each modified line from the two textboxes into a separate item in listbox

here is the code
Code:

Dim sb As New System.Text.StringBuilder
        Dim s As Integer = RichTextBox2.Lines.Length
        Dim c As Integer = RichTextBox3.Lines.Length
        For i As Integer = 0 To RichTextBox2.Lines.Length - 1
            If s <> c Then
                MsgBox("No. of lines in two lists are not Equal")
                Exit For
            Else
               
                sb.AppendLine(RichTextBox2.Lines(i) & ":" & RichTextBox3.Lines(i) & Environment.NewLine)

               

            End If


        Next
        ListBox1.Items.Add(sb)


Viewing all articles
Browse latest Browse all 27333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>