Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set listview item index

Status
Not open for further replies.

jpack23

Programmer
Dec 15, 2004
82
0
0
US
this is related to the weirdest thing with message box thread.

trying to work around whatever is causing that box to pop up twice.

I have a MDI parent form with a listview using an image list as icons. When a user clicks an icon a child form is loaded in the mdiparent.

Is there a way to get and set the index of the icons in my listview.

I would like to be able to set the selecteditem using code.

what i am trying to accomplish is each time and icon is selected run a sub routine that check to see if the user has been identified in the system, if not I want to clear the list so if a user clicks on that very same Icon it will run the check sub routine agian. My app works if the user selects a different icon, but not if he or she selects the same one.

This is where I am running into looping problems with the selectedItem or Indexchange event.....so instead of calling check sub routine in those events I want to put that call in the event in the chilformload event....seems to me that would require me to add code somewhere to clear and change the selected item if the checkemps sub returns false.

any ideas?

thanks
 
To get the selected item on the listview_Click event do:

Dim lvTemp As ListViewItem = listview.SelectedItems(0)

then lvtemp will have all items and subitems for row.

Louie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top