binding a combobox to a dataset and value changes appropriately for current record

joe789

Registered User.
Local time
Today, 13:20
Joined
Mar 22, 2001
Messages
154
Binding a combobox to a dataset and value changes appropriately for current record selected?

I have a dataset in a vb.net form that is linked successfully to a sql server table with fields from the table being displayed on the form appropriately. I have created a combobox and populated it with a collection of items the user can select from. I am attempting to bind that combobox to a field in the linked table, so that as the user navigates thru the records in the dataset the appropriate value is displayed in the combobox and if a user selects a value from within the combobox that value is automatically updated/replaced/changed in the appropriately bound field. I am wrestling with this one - any help would be greatly appreciated. Thanks!
 
Same issue i am having except not with sql on line, just in access
 
G'd Evening!
Joe: When you bind your txtboxes you can bind your combobox as well. You just have to be sure that it is populated before binding. Then you can do something like this:
Me.cboYourCombobox.Value = CInt(YourObject("YourTableField")).
YourObject is anything that supports the IEnumerable interface, might be a dataset, datatable, arrays, a class etc.

DirtDiver:
In ms access you just have to use the Form_Current() event and set your combobox to a table's field like this:
Me.cboYourCombo = Me.txtPKField

G'd luck
 

Users who are viewing this thread

Back
Top Bottom