combobox and dataset indexOf

  • Thread starter Thread starter merco
  • Start date Start date
M

merco

Hi, i'm populating a combobox small datas from a Dataset.
Dim Ds As DataSet
Ds = GetDS("Select * from Utenti")
Cb.Items.Clear()
Cb.DataSource = Ds.Tables(0)
Cb.DisplayMember = "Descrizione"
Cb.ValueMember = "Codice"

It's a simple "Users" table with ID (codice) and description
(descrizione).
Is there a way to pre-select an item by it's code without cycling for
all items in combobox ?

I've tried , with no success, indexof ,passing only a string type
parameter (the code)...

thanks
 
ok, but i don't know the "number of the Item you want display" i only
know the code..."ID"
 
Does the following not work?

ComboBox1.SelectedValue = "The Codice you want here" //(assuming codice is a
string)
 
Back
Top