• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

Listview Question

Hello Experts:

I have a listview that contains a list of clients.  Column 1 contains the clientid and column 2 contains the client name.

I also have a janusys grid on the form which will display a filtered invoice listing based on the client that is selected in the client listview.

I have recently added a search button to allow the user to search for an invoice, which works correctly, by displaying the invoice that was searched for in the janus grid.  However, I also want to highlight the client in the client list that the invoice corresponds to, I've tried several things with no results.

Here is what I am trying

ClientList is the Listview displaying the clients
strReturnCustomer is the clientid field Im trying to match up to column 1 in the listview

For Counter = 1 To ClientList.ListItems.Count
     If ClientList.ListItems(Counter) = strReturnCustomer Then
                ClientList.ListItems(Counter).selected= True
     End If
Next

Thanks

VB 6.0
0
escheider
Asked:
escheider
  • 5
  • 3
1 Solution
 
CodeWizrdCommented:

If you are checking on customer number, then change your if statement to:

If ClientList.ListItems(Counter).subitems(1) = strReturnCustomer Then

This way you are validating only the first column in your list box.
0
 
escheiderAuthor Commented:
ClientList.ListItems(Counter).subitems(1) would reference the customer name, not the customer id.
0
 
CodeWizrdCommented:

oops...I typed a 1, didnt I?  Problem with coding too many languages...

Did the subitem help you match your customer id and highlight the row you wanted?

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
escheiderAuthor Commented:
no,

ClientList.ListItems(Counter) appears to be referencing the clientid column, but ClientList.ListItems(Counter).selected= True doesn't appear to be working.  The IF statement is triggered, but the client being referenced is not highlighted.
0
 
escheiderAuthor Commented:
hmmm, i put a clientlist.setfocus above the clientlist.listitems(counter) line, and it appears to work now.
0
 
CodeWizrdCommented:

Interesting...well, congrats on getting it working!
0
 
escheiderAuthor Commented:
freaky...do you want the points or should I delete this question??
0
 
escheiderAuthor Commented:
Since I answered the question myself, I decided to delete this question.  Thanks for your input though
0
 
NetminderCommented:
Per request, points refunded and question closed by
Netminder
CS Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now