-
i have added a listview to my form called lsthistory that i want to display data from my sql7 database in.
i want to display 3 seperate fields of data within my listbox control and be able to add new data this way too???
can this be done???
thanks in advance!!!
-
i put this first code in the form load event
so the form looks right when it is first seen.
Code:
'set up the listview header lstSLines
With Me
.lstSLines.ColumnHeaders.Add , , "No Of Pieces"
.lstSLines.ColumnHeaders.Add , , "Description"
.lstSLines.ColumnHeaders.Add , , "Weight"
.lstSLines.ColumnHeaders.Add , , "Class"
.lstSLines.ColumnHeaders(3).Alignment = lvwColumnRight
End With
next i run my queries and then fill in the columns:
Code:
'fill the lines in the appropriate columns
While Not rsSLines.EOF
Set iSubItems = lstSLines.ListItems.Add(, , CStr(rsSLines!Pieces))
iSubItems.SubItems(1) = CStr(rsSLines!Description)
iSubItems.SubItems(2) = CStr(rsSLines!Weight)
iSubItems.SubItems(3) = CStr(rsSLines!Class)
rsSLines.MoveNext
Wend
Set iSubItems = Nothing
i hope it makes a little sense...
-
thanks
i have never used the listview control before.
i have tried the first part of the code in my form load event. but it does not seem to display my headings in my listview control any ideas why not??
-
There is a property that can be checked on or off, its called something like "HideColumnHeaders" (I don't have VB loaded on this machine at the moment so I can't check the exact name of the property).