[Gambas-user] ListBox selection

Benoît Minisini gambas at ...1...
Wed Jun 15 20:00:41 CEST 2011


> i have in a ListBox the next values
> 
> index0, 1
> index1, 11
> index2, 111
> index3, 1111
> index4, 11
> 
> i want to multiple select values and able to delete them.
> 
> to do this i use lstBox.Find() to get the selected index from
> lstBox[i].Text
> 
> But Find returns the first value which is found and if i select the
> index 4, "ii" is not possible to delete. Instead it is deleted the index
> 1, according to Find.
> 
> If the .ListBoxItem could return the Key of item this could be possible
> something like that
> 
> 
> lstBox.Remove(lstBox[i].Index)
> 
> So in above example i could delete values index3=1111, index4=11
> and not index3=1111, index1=11
> 
> Is it possible the .ListBoxItem return the index?
> I tell this if it could be add to wish-list.

In ListBox, Index is not absolute, but relative. If you delete an item, the 
index changes.

If you want an absolute index, use a ListView instead.

Regards,

-- 
Benoît Minisini




More information about the User mailing list