473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using BindingNavigator and ComboBox of data bound items

bds
I'm new to .net 2.0 and I'm trying to figure out the best way to create a
form that has a couple of controls and one of the controls is a combo box
with a data bound list of items from another table.

To understand the problem more, consider using the AdventureWorks2000
database. I want a simple form that shows FirstName, LastName, and Shift.
Instead of the ShiftID, I want the shift name from the Shift table to be
displayed.

Here's what I've tried:
1. Create dataset with Employee table and Shift Table.
2. Drag employee FirstName and LastName on the form
3. A BindingNavigator and BindingSource were created when FirstName was
dragged onto the form.
4. Change ShiftID to a comboBox and drag it onto the form
5. Configure the combobox to bind to the ShiftBindingSource
6. Select ShiftId as the Value Memeber.
7. Select Name as the Display Member
I have two problems:
1. Once the data item list is displayed in the combobox, the Display Member
(Shift.Name) is not the right display member for the display value
(employee.ShiftId). Do I have to synchronize the two BindingSources? Do I
have to use only one BindingSource and join Employee and Shift in one query?
Something else?

2. How do I make ShiftID get inserted or updated in the employee table from
a selection in the comboBox?

--
-bds
Aug 17 '05 #1
2 9556
Hi,

"bds" <bd*@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com...
I'm new to .net 2.0 and I'm trying to figure out the best way to create a
form that has a couple of controls and one of the controls is a combo box
with a data bound list of items from another table.

To understand the problem more, consider using the AdventureWorks2000
database. I want a simple form that shows FirstName, LastName, and Shift.
Instead of the ShiftID, I want the shift name from the Shift table to be
displayed.

Here's what I've tried:
1. Create dataset with Employee table and Shift Table.
2. Drag employee FirstName and LastName on the form
3. A BindingNavigator and BindingSource were created when FirstName was
dragged onto the form.
4. Click on the arrow next to the Shift table ( not ShiftID )
(4.1 If you don't see an option for combobox then click customize and check
combobox)
4.2 Change Shift table to combobox

5. Drag Shift Table onto form, you should see a combobox on the form

6. Open combobox properties
6.1 Check if DataSource/ DisplayMember and ValueMember are correct
6.2 Expand (DataBindings)
(6.3 If you see a binding for Text then click on the arrow and set the
binding to None)
6.4 Click on the arrow next to SelectedValue and bind to
EmployeeBindingSource - ShiftID
That should make the combobox work in both directions (from and to
Employee).

HTH,
Greetings


I have two problems:
1. Once the data item list is displayed in the combobox, the Display
Member
(Shift.Name) is not the right display member for the display value
(employee.ShiftId). Do I have to synchronize the two BindingSources? Do
I
have to use only one BindingSource and join Employee and Shift in one
query?
Something else?

2. How do I make ShiftID get inserted or updated in the employee table
from
a selection in the comboBox?

--
-bds

Aug 17 '05 #2
bds
That's it. Thanks.

I guess the key thing I was missing was dragging the whole table out (the
Shift table in my case).

--
-bds
"Bart Mermuys" wrote:
Hi,

"bds" <bd*@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com...
I'm new to .net 2.0 and I'm trying to figure out the best way to create a
form that has a couple of controls and one of the controls is a combo box
with a data bound list of items from another table.

To understand the problem more, consider using the AdventureWorks2000
database. I want a simple form that shows FirstName, LastName, and Shift.
Instead of the ShiftID, I want the shift name from the Shift table to be
displayed.

Here's what I've tried:
1. Create dataset with Employee table and Shift Table.
2. Drag employee FirstName and LastName on the form
3. A BindingNavigator and BindingSource were created when FirstName was
dragged onto the form.


4. Click on the arrow next to the Shift table ( not ShiftID )
(4.1 If you don't see an option for combobox then click customize and check
combobox)
4.2 Change Shift table to combobox

5. Drag Shift Table onto form, you should see a combobox on the form

6. Open combobox properties
6.1 Check if DataSource/ DisplayMember and ValueMember are correct
6.2 Expand (DataBindings)
(6.3 If you see a binding for Text then click on the arrow and set the
binding to None)
6.4 Click on the arrow next to SelectedValue and bind to
EmployeeBindingSource - ShiftID
That should make the combobox work in both directions (from and to
Employee).

HTH,
Greetings


I have two problems:
1. Once the data item list is displayed in the combobox, the Display
Member
(Shift.Name) is not the right display member for the display value
(employee.ShiftId). Do I have to synchronize the two BindingSources? Do
I
have to use only one BindingSource and join Employee and Shift in one
query?
Something else?

2. How do I make ShiftID get inserted or updated in the employee table
from
a selection in the comboBox?

--
-bds


Aug 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
3
by: Pete | last post by:
I'm currently doing a database that uses comboboxes to look up records in other tables, whether they be lookup tables or otherwise. When a user needs to add an item to one of these tables, the...
2
by: Michael Schindler | last post by:
why see my combobox not in datagrid with values(offen, closed) not to column the 5? Please help me! This is my first combobox and i have no idea what i can to do. My source:
2
by: John Tyce | last post by:
When a button is clicked, a date is inserted or added into a combo box like this : ComboBox.Items.Add(string) or ComboBox.Items.Insert(0,string); Either way, the new string does not show up in the...
1
by: Norm Katz | last post by:
When you use a bound combobox and you set its dropdown style to "dropdown" that allows you to enter text in the edit box. But if you enter anything other than a value in the current bound items...
2
by: bds | last post by:
I'm new to .net 2.0 and I'm trying to figure out the best way to create a form that has a couple of controls and one of the controls is a combo box with a data bound list of items from another...
2
by: shumaker | last post by:
I have a combobox that is very much like the one found in the RSS project here: http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/ My projectNameComboBox basically is filled with a...
5
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but...
2
by: GS | last post by:
I see in the design view of the binding navigator that the items like next Item, prev item... are enabled but when I run, the form, somehow they got disabled. I can still scroll thru the gridview...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.