Results 1 to 14 of 14

Thread: cant use the list view's dbl Click...

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Angry cant use the list view's dbl Click...

    Umm when a user dbl clicks on a listview item, how can I cast from the sender object to a listview item? it doesnt work, dunno how to do it.
    I just want to know what item is clicked in the double click event of a listview

    tnx
    Last edited by MrPolite; Jun 26th, 2002 at 05:00 PM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Junior Member
    Join Date
    Jun 2002
    Location
    Florida
    Posts
    16

    casting sender to listbox

    try this in the event...
    Dim lv As ListView = CType(sender, ListView)

    then you should be able to expose e.g.

    lv.selectedindex

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    ooooh tnx!
    I was trying to cast from object to listViewitem

    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    I'm having problemmos
    When the uer dblClicks, I want to know what item was clicked. SelectedItems() wont work because the MultiSelect property in my listView is set to true. Also if the user dblClicks on a checkbox next to a listview item, the doubleclick event will fire, but no item was actually clicked.
    I need to know if an item was actually clicked and if so which item it is....
    any one can help me about this
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    bump bump
    I thought it's really simple! that's what the title suggests!
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    bump
    no really, bump

    need help peopleZ....
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    VB Code:
    1. Do
    2.      MsgBox ("[b]bump[/b]")
    3. Loop While True = True
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  8. #8
    Lively Member
    Join Date
    Aug 2001
    Posts
    65
    Did you ever find an answer to this?

    I need to get the index of the item selected in a listview

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    naah, I looked back to my project again... I gave up the idea of using check boxes

    what's your problem right now? casting? or figuring out if an item was really clicked?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10
    Lively Member
    Join Date
    Aug 2001
    Posts
    65
    Well, i need to find the index of the item that was clicked.

    I have had to use the .FocusedItem because there isn't a .SelectedIndex anymore, but now i have found that the focuseditem isn't necessarly the item clicked....if you can follow what i mean.

    If i click on the second item in the listview to send this item to a form to be edited, it will in fact get the first item in the listview not the second or third, ect.

  11. #11
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    How can you doubleclick multiple items?

    'SelectedItems() wont work because the MultiSelect property in my listView is set to true.' If Multiselect is true then it should still work hence the s at the end. It just is a collection of items instead.

  12. #12
    Lively Member
    Join Date
    Aug 2001
    Posts
    65
    Actually, don't worry about my last post, .FocusedItem does still work ok.

    I looked at it in debug and poped up a message box and it held the correct index and items, so the problem must be somewhere else. I think it's getting the first item from the array, not sure whats going on yet.

  13. #13

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    you could just check SelectedItems(0)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  14. #14
    Lively Member
    Join Date
    Aug 2001
    Posts
    65
    Ahhhhhhh, i worked out what the problem was, i forgot to add 1 to the array that was why it was getting the first item all the time.
    When i added a third item to the listview it was getting the second one and it then dawned on me what i had done.

    This is what happens when your tired and been staring at code for six hours.

    Must remember to get up and get out of the house, once in awhile.

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