0

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

Edited by lanz80: n/a

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by Lee21
0

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
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.