Results 1 to 7 of 7

Thread: Big problem!! Look here!

  1. #1

    Thread Starter
    Lively Member The_Fog's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Posts
    65

    Unhappy

    Ok.. Here's the deal. I've got a listbox with ALOT of names in it. I can check them one by one, and delete them one by one by pressing the Cmdbutton that are linked to that function, but I'd like to be able to use a button on the tgb insted, lika "delete" (which is the most logical button for this operation..
    How do I do this??
    I'd also like to be able to check more then one name at the time, and delete them all at once. help plz...

    Thanks in advance!

    They will try to steal everything you own,
    It goes on and on and on...


    Pain - On and On

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    hmmm... what's a tgb?

    and ehrm.. here's code to delete multiple selections

    Code:
    For x = 0 To List1.Listcount - 1
       If List1.Selected(x) Then List1.RemoveItem x
    Next x
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Lively Member The_Fog's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Posts
    65
    Tgb = Tangenbord = keyboard..
    Sorry.. Couldn't remember the english transaltion at the time, så I wrote tgb and hoped that people would understand it anyway.
    Thanks for the help with the delete-problem.
    They will try to steal everything you own,
    It goes on and on and on...


    Pain - On and On

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    oh, for the tangenbord I have this solution...
    Code:
    'Set the forms KeyPreview to True
    Private Sub Form_KeyDown(KeyCode As Integer)
    If KeyCode = vbKeyDelete Then
    'call the sub from here
    End If
    End Sub
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  5. #5
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    Or try this (I had problems going from 0 to List1.ListCount -1 while deleting multiple selection so I did it in reverse)
    Code:
    '//Set Form's KeyPreview property to True
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        Dim I As Integer
        If KeyCode = vbKeyDelete Then
            For I = List1.ListCount - 1 To 0 Step -1
                If List1.Selected(I) Then
                    List1.RemoveItem (I)
                End If
            Next I
        End If
    End Sub

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Yep, that's even better mate!!! because you won't get any probs with 'missing' listitems cool!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7

    Thread Starter
    Lively Member The_Fog's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Posts
    65
    Thanks for the help! U rock!
    They will try to steal everything you own,
    It goes on and on and on...


    Pain - On and On

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