adding combobox item data

  • Thread starter Thread starter kmercer46
  • Start date Start date
K

kmercer46

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??
 
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
 
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,
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
 
I have vb.net 2003 and framework 1.1 with sp1 and have several apps where I
set comboboxes to -1 routinely and haven't had any problems so it must have
been fixed. I typically use

combobox.Selectedindex = combobox.findstringexact and when it doesn't find
the string, it sets the combobox to -1.
 
Back
Top