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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to bind a ComboBox

Status
Not open for further replies.

sahernandez

Programmer
Oct 1, 2002
69
SV
Hi, I'm new in VB.NET ,
I trying to Bind a Combobox,

And use this code
I've already connect to my DataBase (ORACLE)
' This is a Fucntion that return a DataTable and it's work

CbEmpresa.DataSource = LoadFunction("select id_empresa , nombre from crews_empresas")
CbEmpresa.DisplayMember = "Nombre"
CbEmpresa.ValueMember = "id_empresa"
'I got the problem here above this line


And the Error say:
"Could not bind to the new display member."

Can anybody help, I know it's not big problem, but I expense 2 hours try to find the way to fix it,

Thxs.
Alexander

 
The exception is because when you set the data source to the data table, value and display member bindings were created for you.

Move the line of code setting the datasource after you have set the value and display members and the code will run.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top