473,654 Members | 3,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagridviewcom boboxcell value is not valid

I apparently have no idea what I am doing. ;o(

I have a datagridview bound to a dataset. I want to make one of the columns
a combobox that displays a list of choices I have in another table. When the
user clicks on that combobox, it should display those choices, allow them to
chose one, then when the save the data, it is saved into the table the
datagrid is bound too.

When I change the column to a combobox and set its datasource to the other
table and the datamember to the field in that other table, then run it, I get
the error above.

I know I am doing something wrong but not sure what it is. Any help would be
appreciated. I hope I have given enough info.

Jan 30 '07 #1
2 18657
On Jan 30, 8:43 pm, Chris <C...@discussio ns.microsoft.co mwrote:
I apparently have no idea what I am doing. ;o(

I have a datagridview bound to a dataset. I want to make one of the columns
a combobox that displays a list of choices I have in another table. When the
user clicks on that combobox, it should display those choices, allow them to
chose one, then when the save the data, it is saved into the table the
datagrid is bound too.

When I change the column to a combobox and set its datasource to the other
table and the datamember to the field in that other table, then run it, I get
the error above.

I know I am doing something wrong but not sure what it is. Any help would be
appreciated. I hope I have given enough info.

Dude the problem you are having is a true pain in the ....

I solved it temporarily by adding a error handler to my datagrid that
does nothing about the error as in the code below

Public Sub on_dataerror(By Val sender As Object, ByVal evt As
Windows.Forms.D ataGridViewData ErrorEventArgs) Handles
DGVsubjects.Dat aError

End Sub


If you have come across the solution please let me know

Mar 29 '07 #2
I had the same problem with a datagrid I wanted to be 'read only'.
When exiting the form I received a message telling me that I hab to handle
the DataError event to avoid my combobox wrong format (???).

Here is what I did :
- open the DataGrid properties
- click in the DataError event line
- type _DoNothingOnDat aError

I have absolutely no idea why such error happens but here is my workaround

Hope this helps.... or if anyone knows how to display a ComboBox column in a
clean way please let us know.
"Chris" wrote:
I apparently have no idea what I am doing. ;o(

I have a datagridview bound to a dataset. I want to make one of the columns
a combobox that displays a list of choices I have in another table. When the
user clicks on that combobox, it should display those choices, allow them to
chose one, then when the save the data, it is saved into the table the
datagrid is bound too.

When I change the column to a combobox and set its datasource to the other
table and the datamember to the field in that other table, then run it, I get
the error above.

I know I am doing something wrong but not sure what it is. Any help would be
appreciated. I hope I have given enough info.
May 16 '07 #3

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

Similar topics

0
3022
by: Moshazu | last post by:
I am attempting to use the DataGridView control in my software and have not been able to easily find answers to a couple of questions that I have. 1. Is the only way to change the data in a DataGridViewComboBox during the runtime the way that I have done it here? If not, is there an easier way? Dim tmpCMBRow As New DataGridViewRow tmpCMBRow.CreateCells(Me.grid)
0
3060
by: Jay | last post by:
I am using Windows .Net 2.0 SDK I have a DataGridView control in a windows form. None of my controls are databound prior to run time. I am creating a string array with which I want to populate each DataGridViewComboBoxCell programmatically. Some of the items in the comboboxcell controls may be the same, but most will not, so I can not populate the DataGridViewComboBoxColumn. I have tried adding rows to the datagrid using Rows.Add. I have...
1
23648
by: hangdee | last post by:
I have a DatagridviewComboBoxCell with self added object (with an id and a string field) as items to the DatagridviewComboBoxCell. Dim cboCell As New DataGridViewComboBoxCell cboCell.Items.Add(new MyObj(1,"Item 1")) cboCell.Items.Add(new MyObj(2,"Item 2")) cboCell.Items.Add(new MyObj(3,"Item 3")) But I cannot find a method from DataGridViewComboBoxCell to get back the selected MyObj in the cboCell list.
1
6441
by: aXqd | last post by:
i want a editable comboboxcell for a datagridview, i have done these: public partial class Form1 : Form { .... private static List<string_tempList = new List<string>(new string {}); ....
0
3393
by: news.microsoft.com | last post by:
Hello- I'm having a dickens of a time trying to set the value on a DataGridViewComboBoxColumn. I actually have two DataGridViewComboBoxColumns in my datagrid view. First, I'm setting up the grid/column as follows.. DataGridViewComboBoxColumn someColumn = new DataGridViewComboBoxColumn();
42
3534
by: polas | last post by:
Afternoon all, I have some code (which I thought was OK, but now appreciate is probably not by the standard) which contains int a; ...... if (a==NULL) { ....
4
2714
by: Martin Horst | last post by:
Hi, I've got a Windows Form DataGridView with several DataGridViewComboBoxCell columns. The Items collection of the DataGridViewComboBoxCell can take any kind of objects. But when the user selects another item inside the combobox, the Value property always returns a string. In my case, I need the real object which was added to the items collections. Is there any way to prevent this conversion. Thanks in advance
0
4254
by: ANILMOURYA | last post by:
private void FlexGrdRsltConv_CellEnter(object sender, DataGridViewCellEventArgs e) { if (blnRowenter) { return;} if (FlexGrdRsltConv.Columns.Name == "TxtEltCode") { DataGridViewComboBoxCell RowComboColumn = new DataGridViewComboBoxCell();
4
10316
by: Jaydeep Ramavat | last post by:
I am facing a problem in binding the datagridviewcombo box cell. DataGridViewComboBoxCell cmbControlTypes= new DataGridViewComboBoxCell(); cmbControlTypes.DataSource = result.resultTable; cmbControlTypes.DisplayMember = "name"; cmbControlTypes.ValueMember = "id"; after binding the comboboxcell and adding it to row. when i access the item collection as follows.
0
8707
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 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...
1
8482
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,...
0
7306
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
bsmnconsultancy
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...

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.