Home All Groups Group Topic Archive Search About

ComboBox values and Items

Author
3 May 2006 3:37 PM
FaWiizio
Is it possible to add an item to a combobox this way:

ComboBox1.Items.Add("Cool!")

AND assign to this new Item a unique index ?

As in HTML

<option value="1">Cool</option>

I would like to override standard indexes (0,1,2,3,...) and write mine.

Is it possible?

Regards.

--
fabri
MKDS nick & friend Code:
Joker® - 055895 043343
---------------------------------
AC Nome, Citta' e codice amico:
Fabrizio, Kanoemi, 1890-4700-1546
---------------------------------

Author
3 May 2006 4:22 PM
VJ
ComboBox1.Items.Insert(1,"Cool!");

VJ

Show quoteHide quote
"FaWiizio" <n*@sp.am> wrote in message news:e3aiia$p70$1@nnrp.ngi.it...
> Is it possible to add an item to a combobox this way:
>
> ComboBox1.Items.Add("Cool!")
>
> AND assign to this new Item a unique index ?
>
> As in HTML
>
> <option value="1">Cool</option>
>
> I would like to override standard indexes (0,1,2,3,...) and write mine.
>
> Is it possible?
>
> Regards.
>
> --
> fabri
> MKDS nick & friend Code:
> Joker® - 055895 043343
> ---------------------------------
> AC Nome, Citta' e codice amico:
> Fabrizio, Kanoemi, 1890-4700-1546
> ---------------------------------
Author
3 May 2006 4:30 PM
Göran_Andersson
You can create your own class for the items. Make it contain an integer
for the index and a string. Override the ToString method to return the
string, that is how the combobox gets the text to display for the item.

Add objects from your class to the combobox. When the user selects an
item you cast the selected item back to your class and get the index.

FaWiizio wrote:
Show quoteHide quote
> Is it possible to add an item to a combobox this way:
>
> ComboBox1.Items.Add("Cool!")
>
> AND assign to this new Item a unique index ?
>
> As in HTML
>
> <option value="1">Cool</option>
>
> I would like to override standard indexes (0,1,2,3,...) and write mine.
>
> Is it possible?
>
> Regards.
>