Listview subitems add

Posts 1–3 of 3 · Page 1 of 1
Listview subitems add
Code:
Dim count As Integer = 0
        ListView1.Items.Add(TextBoxX1.Text)
        ListView1.Items(count).SubItems.Add(TextBoxX2.Text)
        ListView1.Items(count).SubItems.Add(TextBoxX3.Text)
        count += 1
    End Sub
Im using that code . . . but In the ListView when you first click the button its all okay. . . but then It just add the first textbox.
whenever you click on add button, it sets "count" to 0 so you must use FOR function like this:
[highlight=vb.net]
on error resume next
ListView1.Items.Add("1")
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add("2")
ListView1.Items(ListView1.Items.Count - 1).SubItems.Add("3")
[/highlight]


You was right, I didn't try it before I post it. Now I'm sure this one will work.

Dunno about saving listview to a my.settings but if I'm gonna do it, I would use streamwriter/reader to save listview to a file
well that code dont do anything :S I fixed it. . .
But now another problem is . . on listview items appears a "Default" In black letters :S
-----------------------------------------------------------------------------------
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us