954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help! Adding Items to ListView with 2 columns

Public Class Movies
Dim a As Integer, b As Integer
Dim titles(a) As String, rating(b) As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListView1.Items.Clear()
Dim names As String, rate As String
Dim listviewItem As ListViewItem
names = TextBox1.Text
rate = ComboBox1.Text
titles(a) = names
a = a + 1
rating(b) = rate
b = b + 1
Array.Sort(titles)
ReDim Preserve titles(a)
ReDim Preserve rating(b)
For Each str As String In titles
For Each str2 As String In rating
If Not IsNothing(str) Then
listviewItem = ListView1.Items.Add(str)
With listviewItem
.SubItems.Add(str2)
End With
TextBox1.Clear()
End If
Next
Next
End Sub
End Class

Whenever I click add, the Items in the first column prints twice. E.g I type in the text box Choco and choose the rating GP. This is what will happen:
Title Rating
Choco GP
Choco
I really need help with it.

rookisan
Newbie Poster
1 post since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: