473,398 Members | 2,125 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,398 software developers and data experts.

DataGridView ComboBox lookup question

I am trying to do something that I would think would be easy.

I have a dataset that is filled from an XML file.

For simplicity, let's say there are two tables:

- Table Customer has fields CustomerID and CustomerName
- Table Orders has fields OrderNo, CustomerID, and ItemNo

My DataGridView shows all orders. What I want is the CustomerID column to
show the customer name and to list all customer names when the user clicks
the drop-down. Obviously, the associated customer ID should be stored in the
table.

I cannot seem to get this to work and am not having a lot of luck finding
help online. Can someone give some insight?

Thanks,
Chris
Jan 12 '07 #1
2 1539
Chris,

That is were it made for.
The combobox has a datasource, a displaymember and a valuemember.
The first is the Table Customer, the second your Customer Name, the thirth
your CustomerID

Cor

"Chris Hlade" <Ch********@discussions.microsoft.comschreef in bericht
news:74**********************************@microsof t.com...
>I am trying to do something that I would think would be easy.

I have a dataset that is filled from an XML file.

For simplicity, let's say there are two tables:

- Table Customer has fields CustomerID and CustomerName
- Table Orders has fields OrderNo, CustomerID, and ItemNo

My DataGridView shows all orders. What I want is the CustomerID column to
show the customer name and to list all customer names when the user clicks
the drop-down. Obviously, the associated customer ID should be stored in
the
table.

I cannot seem to get this to work and am not having a lot of luck finding
help online. Can someone give some insight?

Thanks,
Chris

Jan 13 '07 #2
Thanks. I knew it could be done but couldn't figure out my problem. My
problem was that I was referring to the wrong table when settings the
ValueMember. Thanks for your help.

"Cor Ligthert [MVP]" wrote:
Chris,

That is were it made for.
The combobox has a datasource, a displaymember and a valuemember.
The first is the Table Customer, the second your Customer Name, the thirth
your CustomerID

Cor

"Chris Hlade" <Ch********@discussions.microsoft.comschreef in bericht
news:74**********************************@microsof t.com...
I am trying to do something that I would think would be easy.

I have a dataset that is filled from an XML file.

For simplicity, let's say there are two tables:

- Table Customer has fields CustomerID and CustomerName
- Table Orders has fields OrderNo, CustomerID, and ItemNo

My DataGridView shows all orders. What I want is the CustomerID column to
show the customer name and to list all customer names when the user clicks
the drop-down. Obviously, the associated customer ID should be stored in
the
table.

I cannot seem to get this to work and am not having a lot of luck finding
help online. Can someone give some insight?

Thanks,
Chris


Jan 14 '07 #3

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

Similar topics

4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
3
by: Danny Nielsen | last post by:
Hi I am having trouble figuring out how to use combobox in a datagridview. What seemed to be a simple task turned out not to arrghh. I have a dataGridView with 4 columns, one of them is column...
3
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my...
4
by: Martin Arvidsson | last post by:
Hi! I have used the SqlCommand and DataReader to read data to a DataSet This dataset is the used to set the properties; DataMember and DataSource of the DataGridView. Now what i want to do is...
8
by: Brian Pelton | last post by:
This is on .Net 2.0 in a WinForms application. I have a DataGridView that is bound to a BindingSource. The DataGridView has 3 columns. The first two are "normal" text columns and the last is a...
3
by: =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post by:
New to databinding in vs2005, I always did it manually in 2003. I have no problem loading comboboxes, and a change in that combobox changes the data in the textboxes but I can not figure out a way...
0
by: rene.marxis | last post by:
Hello i have some DataGridView which is bound to some BindingSource. The date consists of customerdata. Every customer has some status saved in one field id_status in the customer table. I'd...
0
by: Andrus | last post by:
I tried to use modeless picklist for DataGridView custom ComboBoxColumn without success. Steps to reproduce issue: 1. Run code 2. Enter some character 3. Press Tab Observed:
18
by: Andrus | last post by:
Marc, Thank you very much. I have issue on implementing add row properly using this. User presses down arrow in last row in grid starting adding new row. Then user changes its mind desiding...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.