• Welcome to Valhalla Legends Archive.
 

Removing user on leave

Started by GoSu_KaOs, November 07, 2004, 11:18 PM

Previous topic - Next topic

GoSu_KaOs

Cant get this to work.

This is my code under ID_LEAVE:

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


It doesent do anything. When the user leaves, the "has left the channel." message showes up. But it doesn't remove the username.

Yegg

for the removing part u only need 1 main line,

lvChannel.ListItems.Remove (lvChannel.FindItem(username).index)

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.