Solved

Listview Question

Posted on 2002-03-21
9
220 Views
Last Modified: 2010-05-02
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
Comment
Question by:escheider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 1

Expert Comment

by:CodeWizrd
ID: 6886930

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
 
LVL 4

Author Comment

by:escheider
ID: 6887036
ClientList.ListItems(Counter).subitems(1) would reference the customer name, not the customer id.
0
 
LVL 1

Expert Comment

by:CodeWizrd
ID: 6887078

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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 4

Author Comment

by:escheider
ID: 6887104
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
 
LVL 4

Author Comment

by:escheider
ID: 6887109
hmmm, i put a clientlist.setfocus above the clientlist.listitems(counter) line, and it appears to work now.
0
 
LVL 1

Expert Comment

by:CodeWizrd
ID: 6887114

Interesting...well, congrats on getting it working!
0
 
LVL 4

Author Comment

by:escheider
ID: 6887192
freaky...do you want the points or should I delete this question??
0
 
LVL 4

Author Comment

by:escheider
ID: 6889468
Since I answered the question myself, I decided to delete this question.  Thanks for your input though
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 6909084
Per request, points refunded and question closed by
Netminder
CS Moderator
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending a email via excel using vba 6 119
Excel VBA, find a string in a column, update a cell 7 117
Copy a row 12 76
Can we place a tooltip on the actual vb6 form 5 57
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question