Code: Select all
Private Sub PopulateListView()
Dim oldExStyle As Long
Dim i As Integer
Dim st As String
Dim tmp As Single
Dim lvItem As ListItem
Dim j As Integer
LockWindowUpdate ListView1.Hwnd
ListView1.ColumnHeaders(4).Width = 0
For i = 1 To 30
Set lvItem = ListView1.ListItems.Add(i, , "This item contains text " & i, 3, 3)
With lvItem
.Tag = ""
st = Format$(DateSerial(2005, 1, 31 - i), "dd.mm.yyyy")
.ListSubItems.Add 1, , st
.ListSubItems(1).Tag = Format$(st, "yyyymmddHHMMSS")<<<<<< error here
tmp = Rnd * 10000
.ListSubItems.Add 2, , Format$(tmp, ".0000")
.ListSubItems(2).Tag = Format$(tmp, "000000000000.0000000000")
.ListSubItems.Add 3, , ""
.ListSubItems(3).Tag = ""
.SmallIcon = 1
.Bold = (i Mod 3 = 0)
.ListSubItems(1).Bold = (i Mod 3 = 0)
.ListSubItems(2).Bold = (i Mod 3 = 0)
If i Mod 4 = 0 Then
.ForeColor = vbRed
For j = 1 To .ListSubItems.Count
.ListSubItems(j).ForeColor = vbRed
Next
End If
End With
Next
ListView1.SortOrder = lvwDescending
ListView1.ListItems(1).Selected = True
LockWindowUpdate 0&
End Sub