Thread

[VB] Next Problem, lol: Combo Boxes (Sdk)

[VB] Next Problem, lol: Combo Boxes // Sdk

1  |  

robbie

Feb 16, 2002, 9:27pm
This is a function I wrote to remove a given name from a combo box:

Function RemoveCit(CitName As String)
For i = 0 To PresIdx
If cbPresent.ItemData(i).text = CitName Then
cbPresent.RemoveItem (i)
End If
Next i
End Function

PresIdx = the number of people in the list

I've also tried removing the .text on cbpresent.itemdata(i) - if I remove
it, it returns 0 which is invalid data and if I add .text I get invalid
qualifier. Either way it crashes whenever someone leaves and for the life of
me I cant work out why...*boggle*

-Robbie

baron

Feb 16, 2002, 9:58pm
Function RemoveCit(AwSession As Long)
For i = 0 To PresIdx - 1
If cbPresent.ItemData(i) = AwSession Then
cbPresent.RemoveItem (i)
Exit For
End If
Next i
End Function

Itemdata can only store a *long*, never a string. It is a bad idea to remove items based on the name, always remove using the session# which is available during AW_EVENT_AVATAR_DELETE, if a bot leaves the area all with the same name will be removed. Also note that cbPresent.ItemData(PresIdx) is out of bounds since the array is zero based, hence the PresIdx-1.

-Baron


[View Quote]

robbie

Feb 17, 2002, 10:04am
I got it sorted, thanks Baron! :)

-Robbie

[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn