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

How to get a DataGridView column to show as combo box.

I have two related tables I wish to use in a grid. The second table has
to drive the list of items apart of a combo box apart of one of the
grids columns. Table 1 schema has columns ( . . . . "Department" . . .
) and needs to populate the entire grid. Table 2 schema had one column
("Department") and needs to populate a combo box attached to one column
of the grid. I attempted to configure this using the DataGridView
wizard but I wasn't able to bind the grid to one source while binding
the combo box column to the other. Any ideas appreciated.

Nov 28 '05 #1
9 9629
Bill,

I understand from Attached that you mean a combobox outside the
datagridview.

The most simple form for that is using the datarelations. See our website,
there is more however here one very simple sample about that using two
datagrids.

http://www.vb-tips.com/default.aspx?...b-8b8620d93761

I hope this helps,

Cor

ps. I have a sample with an outside attached combobox however because it is
in fact not logical never placed that on this website. Have as well a look
for a combobox inside your datagridview. This was something that was not in
a datagrid and therefore you see samples on our website how to do it with a
datagrid.

From a message from Pieter to this newsgroup, I have understood that the
inbuild combobox in the datagridview is the most simple format, I did not
use that yet.
Nov 28 '05 #2
Bill,

I see in a message from you to Kay that the sample I gave you is not what
you need, I did not do this with a datagridview, however if you want that,
than I can try, can be interesting.

Cor
Nov 28 '05 #3
Hi,

http://msdn2.microsoft.com/en-us/lib...atasource.aspx

Ken
--------------
<bi*********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have two related tables I wish to use in a grid. The second table has
to drive the list of items apart of a combo box apart of one of the
grids columns. Table 1 schema has columns ( . . . . "Department" . . .
) and needs to populate the entire grid. Table 2 schema had one column
("Department") and needs to populate a combo box attached to one column
of the grid. I attempted to configure this using the DataGridView
wizard but I wasn't able to bind the grid to one source while binding
the combo box column to the other. Any ideas appreciated.

Nov 28 '05 #4


Cor & Ken,

Thanks for the input. I didn't take the time to read the msdn link
yet but will check it out later today. To clarify my statement above: I
actually am trying to build the Combo box inside the data grid.
Playing with Visual Studio 2005 is a little different and takes some
effort getting use to. At first I didn't like it but as I make
progress, I'm liking it more and more. Using the "Data Source window" I
was able to accomplish most of my task. Here is what I did: Open data
source window, using the add connection wizard (displayed at top of the
window), established and complete the steps for a connection to DB
tables of interest, now select one of the tables displayed in the Data
Source window and expand it to display all the fields, select one of
the fields and click on the down arrow attached to the right side of
it, select combo-box, drag the table onto the form. The grid now has
data source attached and combo-box inside of it. The next trick I still
have to due is attached the second table to the "items" property
associated with my combo box field.

Nov 29 '05 #5


Cor & Ken,

Thanks for the input. I didn't take the time to read the msdn link
yet but will check it out later today. To clarify my statement above: I
actually am trying to build the Combo box inside the data grid.
Playing with Visual Studio 2005 is a little different and takes some
effort getting use to. At first I didn't like it but as I make
progress, I'm liking it more and more. Using the "Data Source window" I
was able to accomplish most of my task. Here is what I did: Open data
source window, using the add connection wizard (displayed at top of the
window), established and complete the steps for a connection to DB
tables of interest, now select one of the tables displayed in the Data
Source window and expand it to display all the fields, select one of
the fields and click on the down arrow attached to the right side of
it, select combo-box, drag the table onto the form. The grid now has
data source attached and combo-box inside of it. The next trick I still
have to due is attached the second table to the "items" property
associated with my combo box field.

Nov 29 '05 #6
Bill,

I tried it using completely the designer.

I opened the data -> datasource and selected in that wizard the NorthWind
database with the tables customers and customerorders.

Than I dragged a datagridview on my form

I set the properties datasource of that (opening that property until I had
by clicking the plus buttons the order table).

After that I opened the edit columns with the link at the bottom. I choise
the idcustomercolumn and said that it was a combobox. I set for that the
datasource to the customer table and set as well the displaymember to
customername and the valuemember to customerid

Than I started debug and it was running showing a nice datagridview with a
combobox with the names of the customers in it, that I could select to
change those.

I hope this helps,

Cor
<bi*********@gmail.com> schreef in bericht
news:11**********************@g47g2000cwa.googlegr oups.com...


Cor & Ken,

Thanks for the input. I didn't take the time to read the msdn link
yet but will check it out later today. To clarify my statement above: I
actually am trying to build the Combo box inside the data grid.
Playing with Visual Studio 2005 is a little different and takes some
effort getting use to. At first I didn't like it but as I make
progress, I'm liking it more and more. Using the "Data Source window" I
was able to accomplish most of my task. Here is what I did: Open data
source window, using the add connection wizard (displayed at top of the
window), established and complete the steps for a connection to DB
tables of interest, now select one of the tables displayed in the Data
Source window and expand it to display all the fields, select one of
the fields and click on the down arrow attached to the right side of
it, select combo-box, drag the table onto the form. The grid now has
data source attached and combo-box inside of it. The next trick I still
have to due is attached the second table to the "items" property
associated with my combo box field.

Nov 29 '05 #7
Hip Hip Hurray,

I got it going. Thanks a bunch for all your help.

- ya !

Nov 30 '05 #8
Hip Hip Hurray,

I got it going. Thanks a bunch for all your help.

- ya !

Nov 30 '05 #9
Hip Hip Hurray,

I got it going. Thanks a bunch for all your help.

- ya !

Nov 30 '05 #10

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

Similar topics

4
by: Aaron Smith | last post by:
Ok, this is an odd one, but I could use some assistance with the framework 2 in VB.Net... I want to have a DataGridViewColumn, only have it use the ComboBox, then when they drop down the...
0
by: Mark Carew | last post by:
Hi, I'm writing a winform app (as practice) that has as one of its features a button that reads an xml file to a datagridview. No matter what I do I get two columns instead of one. The...
0
by: Roger Odermatt | last post by:
Hello I have binding a class to a DataGridView and this class have a property from another class and this i want binding to a DataGridViewComboBoxColumn. So when i change a item in the Combo and...
1
by: Rich | last post by:
Hello, I am reading data from a sql server table that is under replication. This table has the replicatin GUID column that is generated with replicatin. I am reading the data from a...
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...
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...
4
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I am trying to populate a DataGridView Combobox column with a different data binding source (dataset) depending upon a selection made in a previous column. I can handle the previous column but how...
2
by: mrstrong | last post by:
Gday, I have a datagridview that I am creating the columns programatically which all seems to work fine. I have a couple of dropdown boxes, so I have set the editMode= EditOnEnter. Now my...
2
by: mrstrong | last post by:
Gday, Why would all my checkboxes inside a datagridview stop working (ie checked state not updating when user clicks) when the datagridview's editmode property is changed to "EditOnEnter"? It...
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
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
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.