Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Combo binding advice, please

I've used VB.NET 2003 Standard to create a form using the wizard.

On the form, I had a bound textbox - txtUnitOfMeasurement.
This was bound to an MS Access table, tblSuppliersProducts, and a numeric field called UnitOfMeasurement.

This worked fine.

I then upgraded to VB.NET 2005 Express, and swapped my textbox for a combo box, and added the following settings to the combo:

Data Bindings - SelectedValue = tblSupplierProductsBindingSource.UnitOfMeasurement
Data Source = tblUnitOfMeasurementBindingSource
Display Member = UnitOfMeasurement
Value Member = MeasurementID

This too is fine, on my experimental dummy first record - it saves my changes to the UnitOfMeasurement field in tblSuppliersProducts - proving, to me, that it is bound correctly. However, when I press 'Add', it retains my previous combo box choice (which isn't a huge problem) on the new record, but when I fill in the remaining fields, and press Save, I get an error message saying that tblSuppliersProducts.UnitOfMeasurement is null.

I am obviously not doing something properly in between changing my text box for a combo box, but I don't know what.

Can you help?
[1240 byte] By [jellyfish5000] at [2007-11-11 10:17:30]