Results 1 to 6 of 6

Thread: ListView

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2001
    Posts
    759

    ListView

    Hi Everyone,

    Inside of a ListView I have two different kinds of icons displayed in the first column. what I would like to do is this. When the user selects an item from the list I would like to run a procedure that corresponds to the icon in the row that was selected. So, for example, if the user selected a row in which there was an 'X' icon displayed, the item in that row would be deleted. If the user selected a row in which there was a 'Y' icon displayed Then nothing would happen. Does anyone have any ideas on how to accomplish this? I would appreciate any help. Thanks.

  2. #2
    Fanatic Member
    Join Date
    Oct 2001
    Location
    didn't decide yet
    Posts
    566
    why don't u add a key to each listview row the key will correspond to each image

    so if a user clicks a x image key xImg--> x will know it

  3. #3
    Hyperactive Member Ed Lampman's Avatar
    Join Date
    Mar 2001
    Posts
    273
    Private Sub ListView1_Click()
    if Listview1.SelectedItem.Image="XImage" then Delete
    end sub

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2001
    Posts
    759
    can you provide an example of using the ListView Key. I am not familiar with using this. Also the image is coming from an image list, so I would have to associate the image on the row with the key. Can all of this be done? Please help if you can. Thanks.

  5. #5
    Hyperactive Member Ed Lampman's Avatar
    Join Date
    Mar 2001
    Posts
    273
    Sorry, forgot that Listviews use Icons, not bitmaps

    Private Sub Listview1_Click()

    If Listview1.SelectedItem.Icon = ImageList1.ListImages("XImg").ExtractIcon Then Delete

    End Sub

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2001
    Posts
    759
    Thank you Ed Lampman. With a little bit of tweaking I got the code to work okay. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width