List View Check All dan Uncheck All

Creating Form for Check All dan Uncheck All

Private Sub Check1_Click()

If Check1.Value = vbChecked Then 'select all
With ListView1
For i = 1 To .ListItems.Count
.ListItems(i).Checked = True
.ListItems(i).Selected = True
Next i
End With

Else 'desel all
With ListView1
For i = 1 To .ListItems.Count
.ListItems(i).Checked = False
.ListItems(i).Selected = False
Next i
End With

End If
End Sub

Private Sub Form_Load()
With ListView1
.ColumnHeaders.Add , , "Name", .Width / 5
.ColumnHeaders.Add , , "Occupation", .Width / 5
End With

Call PopulateListView
End Sub
Sub PopulateListView()
Dim li As ListItem
Dim j As Integer

For j = 1 To 9

Set li = ListView1.ListItems.Add(, , "Andri")
li.SubItems(1) = "Programmer"

Next j

End Sub

Read Users' Comments (0)

0 Response to "List View Check All dan Uncheck All"