Hi,

I would like to how I can load a set of values in a comboBox from a TableAdapter. I have the tableAdapter method to read the data , (in this case GetDataByStreet)--> Me.StreetsTableAdapter.GetDataByStreet()

But I don't know how to assign the sentence to the comboBox, in order to load the data set in it.

I have created this code to prove:

StreetCombo.DisplayMember = "AreaClasification"
StreetCombo.ValueMember = "AreaClasification"
StreetCombo.DataSource = Me.StreetTableAdapter.GetDataByStreet()

But It doesn´t work because only fills the first index of the comboBox, but not the following values.


Thanks with anticipation.

Regards

Try to use datatable with the dataadapter

'where sqlcon is a connection
'cboDepcode is the combobox

dt = New DataTable
        sda = New SqlDataAdapter("SELECT DEPTCODE FROM KDEPARTMENT", sqlcon)
        sda.Fill(dt)
        cboDepcode.DataSource = dt
        cboDepcode.DisplayMember = dt.Columns(0).ColumnName
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.