Hi all,
I've got a DataGridView bound to a DataTable, and I need to make
some of the columns into ComboBoxColumns . I've tried some of the
solutions listed here, but I can't seem to make them work. They might
not be the solutions I'm looking for; I just want to have a few
arbitrary values for a combo box and make sure everything in that row
is one of those values. My boss won't let me just leave them as text
boxes. How do I tell the DataTable to tell the DataGridView to display
a ComboBox?
Thanks,
John 5 2056
Hi
Why don"t you use the extended properties of Datacolumn of the Datatable ?
<jj******@gmail .coma écrit dans le message de news: 11************* *********@j72g2 00...legr oups.com...
Hi all,
I've got a DataGridView bound to a DataTable, and I need to make
some of the columns into ComboBoxColumns . I've tried some of the
solutions listed here, but I can't seem to make them work. They might
not be the solutions I'm looking for; I just want to have a few
arbitrary values for a combo box and make sure everything in that row
is one of those values. My boss won't let me just leave them as text
boxes. How do I tell the DataTable to tell the DataGridView to display
a ComboBox?
Thanks,
John
It needs to be automatic; it takes 45 seconds to load 5,000 rows
without binding, but only 6 seconds with binding. Somehow, I need to
have the DataSource create a ComboBox column automatically.
- John
Thierry wrote:
Hi
Why don"t you use the extended properties of Datacolumn of the Datatable ?
<jj******@gmail .coma écrit dans le message de news: 11************* *********@j72g2 00...legr oups.com...
Hi all,
I've got a DataGridView bound to a DataTable, and I need to make
some of the columns into ComboBoxColumns . I've tried some of the
solutions listed here, but I can't seem to make them work. They might
not be the solutions I'm looking for; I just want to have a few
arbitrary values for a combo box and make sure everything in that row
is one of those values. My boss won't let me just leave them as text
boxes. How do I tell the DataTable to tell the DataGridView to display
a ComboBox?
Thanks,
John
In Brian Noyes' databinding book, he has one example where
he creates a DataGridView, and has different kinds of columns
in it. One of them is a dropdown combo box. He says this is
one of the most complicated to implement.
I recommend that you go to his website www.softinsight.com/databindingbook
and download the code and look at the project in Chapter6
called ColumnTypes.
I'd post some of it here, but there's a lot of it,
tied to different events (like editing the grid).
If you want to run it, you will need to set up the database
he's using; those scripts are on the same webpage.
Then you should buy this book; it's invaluable.
Robin S.
---------------------------
<jj******@gmail .comwrote in message
news:11******** **************@ l12g2000cwl.goo glegroups.com.. .
It needs to be automatic; it takes 45 seconds to load 5,000 rows
without binding, but only 6 seconds with binding. Somehow, I need to
have the DataSource create a ComboBox column automatically.
- John
Thierry wrote:
Hi
Why don"t you use the extended properties of Datacolumn of the Datatable ?
<jj******@gmail .coma écrit dans le message de news: 11************* *********@j72g2 00...legr oups.com...
Hi all,
I've got a DataGridView bound to a DataTable, and I need to make
some of the columns into ComboBoxColumns . I've tried some of the
solutions listed here, but I can't seem to make them work. They might
not be the solutions I'm looking for; I just want to have a few
arbitrary values for a combo box and make sure everything in that row
is one of those values. My boss won't let me just leave them as text
boxes. How do I tell the DataTable to tell the DataGridView to display
a ComboBox?
Thanks,
John
Ah ha! Thanks, that had what I needed. In case anyone else is
wondering, here's what you do:
1. Create a DataGridView with the columns and column types (text,
combobox, checkbox, etc) that you want.
2. Set DataGridView.Au toGenerateColum ns to false.
3. Create and fill a DataTable with your data.
4. The important (and non-obvious) part: each existing column in the
DataGridView must be individually connected to its corresponding column
in the DataTable:
DataGridView.Co lumns[0].DataPropertyNa me = "Column0";
DataGridView.Co lumns[1].DataPropertyNa me = "Column1";
...
5. Set DataGridView.Da taSource to the DataTable from 3.
You would think that if AutoGenerateCol umns is false, the grid would
automatically connect its columns to the columns of its DataSource, but
I guess it would be too hard to figure out if it's supposed to match
them by position or name or something else, so they left it up to the
programmer.
- John
RobinS wrote:
In Brian Noyes' databinding book, he has one example where
he creates a DataGridView, and has different kinds of columns
in it. One of them is a dropdown combo box. He says this is
one of the most complicated to implement.
I recommend that you go to his website www.softinsight.com/databindingbook
and download the code and look at the project in Chapter6
called ColumnTypes.
I'd post some of it here, but there's a lot of it,
tied to different events (like editing the grid).
If you want to run it, you will need to set up the database
he's using; those scripts are on the same webpage.
Then you should buy this book; it's invaluable.
Robin S.
---------------------------
<jj******@gmail .comwrote in message
news:11******** **************@ l12g2000cwl.goo glegroups.com.. .
It needs to be automatic; it takes 45 seconds to load 5,000 rows
without binding, but only 6 seconds with binding. Somehow, I need to
have the DataSource create a ComboBox column automatically.
- John
Thierry wrote:
Hi
Why don"t you use the extended properties of Datacolumn of the Datatable ?
<jj******@gmail .coma écrit dans le message de news: 11************* *********@j72g2 00...legr oups.com...
Hi all,
I've got a DataGridView bound to a DataTable, and I need to make
some of the columns into ComboBoxColumns . I've tried some of the
solutions listed here, but I can't seem to make them work. They might
not be the solutions I'm looking for; I just want to have a few
arbitrary values for a combo box and make sure everything in that row
is one of those values. My boss won't let me just leave them as text
boxes. How do I tell the DataTable to tell the DataGridView to display
a ComboBox?
>
Thanks,
John
>
But don't you also have to connect the column of the combobox
to the list of values you want to see in it?
Robin S.
--------------------------
<jj******@gmail .comwrote in message
news:11******** *************@7 9g2000cws.googl egroups.com...
Ah ha! Thanks, that had what I needed. In case anyone else is
wondering, here's what you do:
1. Create a DataGridView with the columns and column types (text,
combobox, checkbox, etc) that you want.
2. Set DataGridView.Au toGenerateColum ns to false.
3. Create and fill a DataTable with your data.
4. The important (and non-obvious) part: each existing column in the
DataGridView must be individually connected to its corresponding column
in the DataTable:
DataGridView.Co lumns[0].DataPropertyNa me = "Column0";
DataGridView.Co lumns[1].DataPropertyNa me = "Column1";
...
5. Set DataGridView.Da taSource to the DataTable from 3.
You would think that if AutoGenerateCol umns is false, the grid would
automatically connect its columns to the columns of its DataSource, but
I guess it would be too hard to figure out if it's supposed to match
them by position or name or something else, so they left it up to the
programmer.
- John
RobinS wrote:
In Brian Noyes' databinding book, he has one example where
he creates a DataGridView, and has different kinds of columns
in it. One of them is a dropdown combo box. He says this is
one of the most complicated to implement.
I recommend that you go to his website www.softinsight.com/databindingbook
and download the code and look at the project in Chapter6
called ColumnTypes.
I'd post some of it here, but there's a lot of it,
tied to different events (like editing the grid).
If you want to run it, you will need to set up the database
he's using; those scripts are on the same webpage.
Then you should buy this book; it's invaluable.
Robin S.
---------------------------
<jj******@gmail .comwrote in message
news:11******** **************@ l12g2000cwl.goo glegroups.com.. .
It needs to be automatic; it takes 45 seconds to load 5,000 rows
without binding, but only 6 seconds with binding. Somehow, I need to
have the DataSource create a ComboBox column automatically.
- John
Thierry wrote:
Hi
Why don"t you use the extended properties of Datacolumn of the Datatable
?
<jj******@gmail .coma écrit dans le message de news: 11************* *********@j72g2 00...legr oups.com...
Hi all,
I've got a DataGridView bound to a DataTable, and I need to make
some of the columns into ComboBoxColumns . I've tried some of the
solutions listed here, but I can't seem to make them work. They might
not be the solutions I'm looking for; I just want to have a few
arbitrary values for a combo box and make sure everything in that row
is one of those values. My boss won't let me just leave them as text
boxes. How do I tell the DataTable to tell the DataGridView to
display
a ComboBox?
>
Thanks,
John
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Meier |
last post by:
How can data be stored in comboboxes similar to html pulldowns? I know I can
access the data of the combobox either by the items text or by its index.
However, I would like to have a pulldown representing something like:
Text: 1 minute; Value: 1
Text: 5 minutes; Value: 5
Text: 1 hour; Value: 60
Thanks. Dave.
|
by: Raed Sawalha |
last post by:
i have datagrid , I added a bound column and I need to map it with two data
fields ...is this possible?
<asp:datagrid id=dgInbox runat="server" EnableViewState="False"
AutoGenerateColumns="False" AllowSorting="True" Width="100%">
<ItemStyle Wrap="False" BorderWidth="11px" BorderStyle="Solid"
CssClass="tableCell"></ItemStyle>
<HeaderStyle Height="26px" CssClass="tableHeaderCell"></HeaderStyle>
<Columns>
<asp:BoundColumn...
|
by: Phil |
last post by:
Hi all
I'm new to vb but have a little experience in vba
im using vb.net
my question is with comboboxes
the fist combo box lists the manufactures when a selection is made the
second combox populates with the available products and when a selection is
made here then next combobox will be populated with model numbers and so on
can someone point me in the direction for this information and also does
information get stored in a data base or...
|
by: GaryDean |
last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much
in answers so I'm reposting some questions posted by some of the programmers
here in our organization that never got answered...
There are articles on the new TableAdapters where it says that a key new
advantage is that a single TableAdapter, which can have multiple queries,
can be used on multiple forms. Now that was in an article on using
TableAdapters with...
|
by: mjsterz |
last post by:
I've been working with VB .NET for less than a year and this is the
first time I've posted on one of these groups, so let me apologize
beforehand if I'm being unclear, not posting my issue correctly,
posting to the wrong forum, or committing some other sort of faux pas.
My team is developing a Windows Forms application using VS 2005 with
SQL Server 2005 on the back end and we're having a problem using
ComboBoxes data bound to lookup...
| |
by: jpenn44 |
last post by:
I have multiple datagridviews on one form. I am allowing editing in the
grid, and am performing error checking.
I am validating the data, if it isn't valid, I am cancelling any other
events fired. My problem is, I am validating in grid A, if they click
in Grid B, I am popping up a message box informing them of the error,
but if they click ok on the message box, and then click in grid B
again, it goes on. The following is a code...
|
by: ECathell |
last post by:
I am trying to databind 2 combo boxes to the same datasource but different fields using the same lookup table. The information in combobox2 is duplicating combobox 1(ie it appears to be gathering the wrong information) I have verified the proper information through query analyzer....
Me.FormatName1ComboBox.DataSource = LabelFormats
Me.FormatName1ComboBox.DisplayMember = "Formatname"
Me.FormatName1ComboBox.ValueMember = "FormatName"
...
|
by: Randy |
last post by:
I have a routine that creates a series of comboboxes, each of which is
bound to a common dataview. Everything used to work fine, but now,
when I change the value of any of the comboboxes, the value in ALL of
the comboboxes changes to the new value. I have boiled down the code
to the simplest lines and placed it on its own form, but I still get
the same behavior. I have stepped through each line of code, and I
don't see any other lines...
|
by: Wingot |
last post by:
Hey,
I have a view to a database that I have created for Client Maintenance. It has
a number of fields, but the important ones are Medical Condition, Bill To, and
Country.
I have a couple of external tables: One for Countries that store each Country
as a ID (char(2)), and Name (varchar(50)) pair; One for Medical Conditions,
using ID (int) and Name (varchar(50)). Also, the BillTo field refers back to
the same table that is being...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |