selecting a row in a listview control
I have the following code on the startup on one of my forms. basically what i am doing is picking up a recordset and then adding the fields to a listview, then highlight a specific row
what i have managed to do through trial and error (as this is the first time i have used the listview control), is to highlight the first field in the row that has a visible field value of true.
This code will highlight the first field in the row, so i can at lest identify the row, but what i actually want it to do is select the whole row. Can anyone help?
many thanks
Debbie
Public Sub frmProjectLog_Startup()
Set Adodc_ProjectLog.Recordset = GetRecordset("Select * from V_ProjectLog where ProjectID = " & gURN)
Dim rs As New ADODB.Recordset
Set rs = Adodc_ProjectLog.Recordset
Dim li As ListItem
With ListView1
.View = lvwReport
With rs
.MoveFirst
Do Until .EOF
If !Visible = True Then
Set li = ListView1.ListItems.Add(, , Format(!Date, "dd/MM/YYYY"))
li.ForeColor = &HFF&
li.SubItems(1) = !Stage
li.SubItems(2) = !User
li.SubItems(3) = !note
li.SubItems(4) = !ProjectNoteID
li.SubItems(5) = !Visible
Else
Set li = ListView1.ListItems.Add(, , Format(!Date, "dd/MM/YYYY"))
li.SubItems(1) = !Stage
li.SubItems(2) = !User
li.SubItems(3) = !note
li.SubItems(4) = !ProjectNoteID
li.SubItems(5) = !Visible
End If
.MoveNext
Loop
End With
End With
End Sub
|