Synchronizing bound combobox and bound textboxes? 
Author Message
 Synchronizing bound combobox and bound textboxes?

Hi All,

I have a vb.net windows form application that I'm
developing and I've hit a conceptual blip that I can't
quite figure out.

My form has a number of textboxes, all bound to a dataset.

One of the fields in the underlying recordset is an
integer field which is supposed to provide a lookup value
in a reference table that contains a list of categories.

Theoretically, I need to populate a combobox on the form
from one underlying table (my table which contains a
unique list of the possible categories along with an
associated integer value), and the other fields on the
form from another (my main recordset). In Microsoft
Access, this is easily achieved because you can define a
recordsource for a combobox not related to the underlying
query powering your form AND store the value selected in
the combobox in a field provided by the underlying query
powering the form.

Sadly I can't work out how to achieve the same thing in
vb.net... Note: if it's important, I'm using vb.net
standard.

I'm wondering if anyone can give me some help with this?

All the best,

L Wells



Fri, 22 Jul 2005 08:40:24 GMT  
 Synchronizing bound combobox and bound textboxes?
there is no equivalent for the Msaccess way of using the
combobox control.

Try this:

Bind your cbox control (databindings) to the dataset as it
is now...

At the point of creating the form at runtime, retrieve the
data needed for the dropdown and fill it into a datatable
in your dataset.
Then in runtime set the datasource property of the cbox to
the filled datatable of the dataset you are using. Set the
displaymember to the one column of the datatable you want
to see and set the vaule member to the column you want to
use in the underlying table...

now it should work. As you scroll through the records, the
list portion of the combo should show the required item
automatically.

Quote:
>-----Original Message-----
>Hi All,

>I have a vb.net windows form application that I'm
>developing and I've hit a conceptual blip that I can't
>quite figure out.

>My form has a number of textboxes, all bound to a dataset.

>One of the fields in the underlying recordset is an
>integer field which is supposed to provide a lookup value
>in a reference table that contains a list of categories.

>Theoretically, I need to populate a combobox on the form
>from one underlying table (my table which contains a
>unique list of the possible categories along with an
>associated integer value), and the other fields on the
>form from another (my main recordset). In Microsoft
>Access, this is easily achieved because you can define a
>recordsource for a combobox not related to the underlying
>query powering your form AND store the value selected in
>the combobox in a field provided by the underlying query
>powering the form.

>Sadly I can't work out how to achieve the same thing in
>vb.net... Note: if it's important, I'm using vb.net
>standard.

>I'm wondering if anyone can give me some help with this?

>All the best,

>L Wells
>.



Fri, 22 Jul 2005 19:48:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Bound textbox fails to bind on some machines

2. synchronizing bound controls

3. synchronize one to many with bound field

4. early binding vs late binding

5. Dataset binding, can a class property be bound ?

6. Data-bound Masked Edit makes all data-bound controls not display data

7. Access 97 bound or not ot bound controls

8. Data Bound Combo Box within a Data Bound Grid

9. How do I bind columns from several tables to one bound control in VB 5.0

10. To Bind or not to Bind ???

11. Activex Server - Early Binding vs. Late Binding

12. Late Binding vs Early Binding in out-of-process servers

 

 
Powered by phpBB® Forum Software