From: kmercer46 on
just asking on how to add item data in combobox??

in vb6;

combo1.additem "Item 1"
combo1.ItemData(combo1.NewIndex) = 1


but how about in .net??

From: Cor Ligthert [MVP] on
Kmercer,

In .Net you have two posibilities. Use a datasource or use the itemarray.

With the itemarray which matches the most your question it is simple (watch
typos)

\\\
combo1.items.add("Item 1")
combo.selectedindex = -1
(in version 2002/2003 twice because of a bug).
///

I hope this helps,

Cor


From: Herfried K. Wagner [MVP] on
<kmercer46(a)yahoo.com> schrieb:
> just asking on how to add item data in combobox??

<URL:http://dotnet.mvps.org/dotnet/code/controls/#ItemData>
(ignore the text and take a look at the code)

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
From: Dennis on
Cor, what did you mean by the line:

(in version 2002/2003 twice because of a bug).

I haven't found any bugs yet in the combo box and I've used it a lot.

--
Dennis in Houston


"Cor Ligthert [MVP]" wrote:

> Kmercer,
>
> In .Net you have two posibilities. Use a datasource or use the itemarray.
>
> With the itemarray which matches the most your question it is simple (watch
> typos)
>
> \\\
> combo1.items.add("Item 1")
> combo.selectedindex = -1
> (in version 2002/2003 twice because of a bug).
> ///
>
> I hope this helps,
>
> Cor
>
>
>
From: Cor Ligthert [MVP] on
Dennis,

> Cor, what did you mean by the line:
>
> (in version 2002/2003 twice because of a bug).
>
> I haven't found any bugs yet in the combo box and I've used it a lot.

Than you are probably one of the luckiest persons on earth, in my idea is it
the control with the most bugs.

One of those is that the combobox does not react if you set the index one
time to -1, a workaround written somewhere is to set it twice.

I agree that I don't see it as well anymore so maybe it is fixed in the sp1.

Cor