how do i choose items from a listbox ?
say like an access thing... ?
QuotePrivate Sub List1_Click()
MsgBox List1.List(List1.ListIndex)
End Sub
hmmm
I tried that with cleanslatebot ...
Code:
CleanSlateBot_UserJoins
If Username = List.List(List.ListIndex) Then
'Don't Ban
Else If Username = Username Then
CleanSlateBot.Send "/ban " & username
Doesnt work...
how would i get it to work with that sort of setup i have there ?
CleanSlateBot_UserJoins
If trim(ucase(Username)) = trim(ucase(List.List(List.ListIndex))) Then
'Don't Ban
Else
CleanSlateBot.Send "/ban " & Username
End If
Try that.
hmmm thats still not working
I have my name on the list but if i join it still bans me...
are u sure that code is right ?
that code compares the name of the user joining to the value of the selected item in the list. you probably want to search through the list and compare the users name to every entry, rather than just the selected one.
yeah how would i do that?
code please
i'm sorta newb to vb6 :(
how do i find a username in a listbox so they dont get banned when they join ?
CleanSlateBot_UserJoins()
For X = 0 to List1.Listcount -1
If trim(ucase(Username)) = trim(ucase(List1.List(X)) Then
'Don't Ban
ElseIf Trim(UCase(Username)) <> List1.List(X) and X = (List1.Listcount - 1) Then
CleanSlateBot.Send "/ban " & Username
End If
Next
Thanks DriveHappy ;D
hmmm...
one more thing... it only works for 1 person if i put more than 1 person in the listbox it bans the first one whys it doin that ??
finditem.
Quote from: TriCk on May 24, 2003, 02:36 AM
how do i find a username in a listbox so they dont get banned when they join ?
Quote from: Camel on May 23, 2003, 08:30 PM
...search through the list and compare the users name to every entry...
or use the [listbox].FindItem method as mesiah pointed out
are u talking about VB .net ? Coz i dont think on VB6 they have ListBox.FindItem ...?
I also own VB .net but im using vb6 for this bot
Trick, it depends on what you have Username set to when you loop it. I'm trying to figure out what you're not doing right, so this is my best guess:
CleanSlateBot_UserJoins()
Dim Username() as String
For Y = 0 to UBound.Username
For X = 0 to List1.Listcount -1
If trim(ucase(Username(Y))) = trim(ucase(List1.List(X)) Then
'Don't Ban
Exit For
ElseIf Trim(UCase(Username(Y))) <> List1.List(X) and X = (List1.Listcount - 1 Then
CleanSlateBot.Send "/ban " & Username(Y)
Exit For
End If
Next
Next
Kind of messy, but it should work. The Username array should contain all the usernames you don't want banned.
Edit: use [ code ] tags.
no drivehappy, that wont work
you have to check every user agains the entire username() array. you're checking everyone against the array one entry at a time and banning them if they're not that element in the array.