Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combobox databinding

Status
Not open for further replies.

HRHK

Programmer
Jun 5, 2005
83
US
I am trying to bind combobox to a datatable (i.e.. dtInvoice). It's not working as I thought. It won't bind and display the correct value. When I check the data table, it has value (i.e. inv_status_id = 1) required for binding. Any suggestions are welcome. Thanks.


cbInvStatus.DataBindings.Add("SelectedValue", dtInvoice, "inv_status_id")
 
and how do you fill the combo?

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Just a suggestion, which I have not tried it yet. But I'm sure it will lead you in the correct solution.

dim row as datarow
for each row in dtinvoice.tables(0).rows
cboBox.Items.Add(row.Item(0))
next

-mike
 
The combobox is binded to a dataset like below.

bc = New BindingContext()
cbInvoiceStatus.BindingContext = bc
With cbInvoiceStatus
.Items.Clear()
.DataSource = dsInvoiceDetails.Tables ("t_invoice_status")
.ValueMember = "inv_status_id"
.DisplayMember = "status_desc"
.SelectedIndex = -1
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top