dim Items as ListItem
While Not adorecord.EOF
'name
If IsNull(adorecord.Fields("name").Value) Then
Else
set Items=lvicon.ListItems.Add( , , Trim(adorecord.Fields("name").Value))
End If
'Icon Path
If IsNull(adorecord.Fields("picpath").Value) Then
Else
Items.SubItems(1) = Trim(adorecord.Fields("picpath").Value)
End If
adorecord.MoveNext
Wend'这样行吗?
While Not adorecord.EOF
'name
If IsNull(adorecord.Fields("name").Value) Then
Else
set Items=lvicon.ListItems.Add( , , Trim(adorecord.Fields("name").Value))
End If
'Icon Path
If IsNull(adorecord.Fields("picpath").Value) Then
Else
Items.SubItems(1) = Trim(adorecord.Fields("picpath").Value)
End If
adorecord.MoveNext
Wend'这样行吗?
'始终是对第一行操作
换成lvicon.ListItems(lvicon.ListItems.Count).SubItems(1) = Trim(adorecord.Fields
原因就是因为我老对第一行操作,现在揭帖
linao:40分
另外两位5分
谢谢咯。
lvicon.ListItems(lvicon.ListItems.Count).SubItems(1) = Trim(adorecord.Fields)
这句话对于升序排列没有问题,但是,对于降序却同样存在问题,我这样分析应该对吧?
所以,最好得办法是用如下方法,如果不考虑排序得话:
i = Lvnename.ListItems.count
i = i + 1
Lvnename.ListItems.Add i, , strnename
Lvnename.ListItems(i).SubItems(1) = strip
这样就可以解决问题了。