dukeman1
12-18-2003, 07:44 AM
I'm working on the listview with columes. My problem is when form is loaded , my long listview will by automatically show from the first item only . It takes time for me to scroll down every time i want to see my inserted new data. Maybe my code is wrong. Please help
Private Sub Display_Listview()
Dim rs As New ADODB.Recordset
Dim rec As Integer
Dim str
Dim mItem As ListItem
lvItem.ListItems.Clear
str = "select * from chip order by stt asc, so asc, trang asc"
rs.Open str, cn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.EOF = False Then
While Not rs.EOF
Set mItem = lvItem.ListItems.Add(, , rs!stt)
mItem.SubItems(1) = rs!so
mItem.SubItems(2) = rs!trang
mItem.SubItems(3) = rs!tacgia
mItem.SubItems(4) = rs!tuade
rs.MoveNext
Wend
End If
End Sub
Private Sub Display_Listview()
Dim rs As New ADODB.Recordset
Dim rec As Integer
Dim str
Dim mItem As ListItem
lvItem.ListItems.Clear
str = "select * from chip order by stt asc, so asc, trang asc"
rs.Open str, cn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.EOF = False Then
While Not rs.EOF
Set mItem = lvItem.ListItems.Add(, , rs!stt)
mItem.SubItems(1) = rs!so
mItem.SubItems(2) = rs!trang
mItem.SubItems(3) = rs!tacgia
mItem.SubItems(4) = rs!tuade
rs.MoveNext
Wend
End If
End Sub