Valhalla Legends Forums Archive | Battle.net Bot Development | Removing user on leave

AuthorMessageTime
GoSu_KaOs
Cant get this to work.

This is my code under ID_LEAVE:

[code]Case ID_LEAVE

frmMain.Channelcount.Text = frmMain.ChannelList.ListItems.Count - 1

If frmConfig.Check5 = vbChecked Then
    AddC RGB(0, 184, 0), Username & " has left the channel" & " [ " & Ping & " ]"
End If

For X = 1 To frmMain.ChannelList.ListItems.Count
  If frmMain.ChannelList.ListItems.Item(X).Text = Username Then
    frmMain.ChannelList.ListItems.Remove Username
End If
Next X


End Select
Exit Function

End Function[/code]

It doesent do anything. When the user leaves, the "has left the channel." message showes up. But it doesn't remove the username.
November 8, 2004, 5:18 AM
Yegg
for the removing part u only need 1 main line,

[code]lvChannel.ListItems.Remove (lvChannel.FindItem(username).index)[/code]

also, for ur stuff like ID_USER, ID_JOIN etc, u should use a class module so that code can be put into ur main form. i think it would b much more organized and readable that way.
November 8, 2004, 11:59 PM

Search