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

Select listview item programatically

Experts, I populate a listview from a database. I have a form for the user to add new items or edit an item. When the user adds a new item I repopulate the listview. When this happens i would like to have the item that was just entered selected for the user.
 
After the INSERT query i retrieve the ID of the record that was just inserted. When the items are added to the listview initially i use the name property of the list item and set it to the ID of the record.

lstItem.name = reader.item("ID")

I would never know the index of the item that was just entered, only the ID of the record.
With the setup i have is there a way to select the item i just entered.
0
Basicfarmer
Asked:
Basicfarmer
1 Solution
 
Luis PérezSoftware Architect in .NetCommented:
Once you've populated your ListView, you can do this:

Me.ListView1.Items(name).Selected = True

For example:

Me.ListView1.Items(reader.Item("ID")).Selected = True

Hope that helps.
0
 
BasicfarmerAuthor Commented:
Thanks for the great response...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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