Private Sub Command32_Click()
If ListView1.ListItems.Count > 0 Then ' VB6 ListView1 根据 ID 选定 指定行开始===========
Dim strfindme As String
Dim itmfound As ListItem '“founditem 变量”
strfindme = 2 '这里设置需要直接查询的ID值就可以了@@@@@@@@@@@@@@@@@@@
Set itmfound = ListView1.FindItem(strfindme, lvwText, , lvwPartial)
If itmfound Is Nothing Then ' 若没有匹配成功,则通知用户并退出。
gg.Caption = "没有找到可选定主机" & strfindme
Else
itmfound.EnsureVisible '滚动 listview 以显示找到的 listitem。
itmfound.Selected = True '选定listitem。
ListView1.SetFocus '将焦点返回给控件以查看选择
End If
Set itmfound = Nothing
End If '选定结束=====================================
End Sub