Private Sub populateListView(dtLoc As DataTable) Dim items As New List(Of ListViewItem) Dim liItem As ListViewItem = Nothing Me.lstLocation.LargeImageList = Me.imgLocations lstLocation.Items.Clear() If (Not (dtLoc Is Nothing)) Then For i As Integer = 0 To dtLoc.Rows.Count - 1 liItem = New ListViewItem() liItem.Text = dtLoc.Rows(i).Item("Controller_Tag").ToString liItem.ToolTipText = dtLoc.Rows(i).Item("Controller_Tag").ToString liItem.ImageIndex = CInt(dtLoc.Rows(i).Item("Image_Index").ToString) items.Add(liItem) Next Me.lstLocation.Items.AddRange(items.ToArray) Me.lstLocation.Update() End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)