What do you mean?
Hey,
i never used to use Listviews, But im making a "WeightWatcher" for my grandmother.
Does anyone knows how i can add items by a button to the next groups?
Credits on release to the guy who helped me
Thanks
What do you mean?
Assembly Programmer
[php]Listview1.items.add("item")
listview1.items(listview1.items.count - 1).subitems.add("bla") 'first subitem
listview1.items(listview1.items.count - 1).subitems.add("bla") 'second subitem
listview1.items(listview1.items.count - 1).subitems.add("bla") 'third subitem[/php]
[php]Msgbox(Listview1.selecteditems(0).subitems(0).text ) 'main item
Msgbox(listview1.selecteditems(0).subitems(1).text ) 'first subitem[/php]
[php] Private Sub SaveListViewContent(ByVal ltv As ListView, ByVal filename As String, ByVal colDelimeter As Char)
Dim sb As New System.Text.StringBuilder
For Each itm As ListViewItem In ltv.Items
Dim colsOfLine As New List(Of String)
For Each colItm As ListViewItem.ListViewSubItem In itm.SubItems
colsOfLine.Add(colItm.Text)
Next
sb.AppendLine(String.Join(colDelimeter, colsOfLine.ToArray))
Next
IO.File.WriteAllText(filename, sb.ToString)
End Sub
Private Sub LoadToListView(ByVal filename As String, ByVal ltv As ListView, ByVal colDelimeter As Char)
If Not IO.File.Exists(filename) Then Throw New IO.FileNotFoundException
For Each line As String In IO.File.ReadAllLines(filename)
Dim colsOfLine() As String = line.Split(colDelimeter)
While colsOfLine.Length > ltv.Columns.Count
ltv.Columns.Add("Column " & ltv.Columns.Count)
End While
ltv.Items.Add(New ListViewItem(colsOfLine))
Next
End Sub[/php]
Last edited by Blubb1337; 07-22-2010 at 09:48 AM.
AeroMan (07-22-2010)
Thanks,Working perfectly
Marked solved, don't post within 7 days unless completely necessary.