genesisproject
asked on
highlighting information in a listbox
is there a way that i can highlight my old values in a list box
i am loading names from an ini file to an ADODB.Recordset
if my value in my adodb.recordset is set to true then highlight the name in the listbox
this is what I have so far
Set companyData = CC.getCompanyListingFromIn iFile(comp anyData, g_sINIfile)
companyData.MoveFirst
While Not companyData.EOF
If companyData.Fields("databa seSelected ").Value = True Then
strFind = companyData.Fields("name") .Value
lngindex = SendMessageString(companyL ist.hwnd, _
LB_FINDSTRINGEXACT, _
-1, _
strFind)
If lngindex > -1 Then
'I AM TRYING TO HIGHLIGHT EVERY LIST INDEX WITH THE CORRECT NAME BUT NOTHING IS HIGHLIGHTED.
MYLISTBOX IS SET TO MULTISELECT = 2
companyList.ListIndex= lngIndex
MsgBox "Item already in List"
End If
End If
companyData.MoveNext
Wend
i am loading names from an ini file to an ADODB.Recordset
if my value in my adodb.recordset is set to true then highlight the name in the listbox
this is what I have so far
Set companyData = CC.getCompanyListingFromIn
companyData.MoveFirst
While Not companyData.EOF
If companyData.Fields("databa
strFind = companyData.Fields("name")
lngindex = SendMessageString(companyL
LB_FINDSTRINGEXACT, _
-1, _
strFind)
If lngindex > -1 Then
'I AM TRYING TO HIGHLIGHT EVERY LIST INDEX WITH THE CORRECT NAME BUT NOTHING IS HIGHLIGHTED.
MYLISTBOX IS SET TO MULTISELECT = 2
companyList.ListIndex= lngIndex
MsgBox "Item already in List"
End If
End If
companyData.MoveNext
Wend
companyList.selected(lngIn dex) = True
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You only had to change the one line.
No need to iterate through the list, the
return from the sendmessage gave the index
of the item you were looking for. And since
you are iterating through the recordset,
everything would be highlighted.
No need to iterate through the list, the
return from the sendmessage gave the index
of the item you were looking for. And since
you are iterating through the recordset,
everything would be highlighted.