|
-
Nov 1st, 2000, 09:11 AM
#1
Thread Starter
Lively Member
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
-
Nov 1st, 2000, 09:15 AM
#2
Frenzied Member
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.
-
Nov 1st, 2000, 09:30 AM
#3
Thread Starter
Lively Member
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
-
Nov 1st, 2000, 09:38 AM
#4
Frenzied Member
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.
-
Nov 1st, 2000, 09:46 AM
#5
Fanatic Member
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
-
Nov 1st, 2000, 09:53 AM
#6
Frenzied Member
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.
-
Nov 1st, 2000, 10:24 AM
#7
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|