-
Oct 22nd, 2008, 12:39 PM
#1
Thread Starter
Hyperactive Member
[2005] DataGridViewComboBoxCell value is not valid
Afternoon!
I have an access database that I added via the Data, Add New Data Source wizard in .NET.
The database has multiple tables.
I created a tab control with the same number of tabs as there are tables.
I created DataGridViews for each of the tables and linked them to the tables and placed them on separate tabs.
In some of the DataGridViews I have comboboxcolumns that are linked to separate tables than the one linked to the DataGridView it belongs to.
The problem is when I change the value of a field in a DataGridView that is a field that populates another DataGridView's comboboxcolumn, when I click to the tab that holds the second datagridview i get the above error (DataGridViewComboBoxCell value is not valid).
Hmm...that may not be clear.
OK, i have 2 DataGridViews that are both linked to separate tables.
dgvVersions (on tab1) has fields: Num, Description, Path
dgvServers (on tab2) has fields: Name, VerNum
VerNum in dgvServers is a comboboxcolumn that is linked to the Num field in table tblVersions.
When i change the Num value on dgvVersions and then go to tab2 i get the above error.
I have tried making the dataset accept changes before going tothe next tab,, but i still get the same error.
Any ideas? Hope i was clear : S
Thanks!
-
Oct 22nd, 2008, 07:53 PM
#2
Re: [2005] DataGridViewComboBoxCell value is not valid
That error message means that the Value property of at least one of the cells in the grid on the tab you're navigating to contains a value that is not in the column of the combo box column's DataSource that is specified by its ValueMember. This might be a data issue or a binding issue. First, you need to determine what all the cell Values are in that column and then make sure that ALL those values do exist in the linked column of the parent table, i.e the ValueMember of the column's DataSource. If they are then the problem is that the way the data is being automatically bound is in the wrong order and you'll have to remove the binding in the designer and do it in code to make sure it doesn't create an invalid intermediate state.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|