the value of datagridviewcomboboxcell is invalid error

I get the above error whenever I use a comboboxcolumn in a datagridview.

I set up the datasource, displaymember and valuemember properties properly.
But, when I run the app, I get this error...

what is the reason of it  anyone who knows the fix of this problem...
Or is this bug in VS.NET 2005 Beta..


Answer this question

the value of datagridviewcomboboxcell is invalid error

  • SaurabhGangwal

    I set the datasource property of DataGridView to a bindingsource (say, BindingSource1)...
    I added a combobox column to the datagridview... Set its Datamemberproperty to a field on Bindingsource1.. I also set its datasource property to another binding source (say, bindingsource2)... and set its displaymember property to a field on bindingsource2 and valuemember property to a field on bindingsource2...

    Just this... And when I run the app, I get the error mentioned above...

    What is the reason of it ... It is just a basic usage of combobox column, nothing special...

  • rogueAgent

    I get the same error, but not consistently.  The frustrating thing is in the same Datagrid I have two comboboxcolumns set up the same way, one works and the other doesn't.  The datagrid is filled from one datasource, and the comboboxcolumns then have other datasources basically containing text labels for ID fields in the first table.  The database tables I'm using as the comboboxcolumn datasources are simple, consisting of an "ID" field (autonumber), and "User" (text) for the one that doesn't work, and "ID" (autonumber) and "Status" (text) for the one that does.  All values in the appropriate columns of the original table are indeed represented in the user and status tables, that was the first thing I checked.

  • adias

    Can you provide more information  I cannot repro this.

    thanks,
    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

  • Grant Perry

    I have a variation on this problem. I had filled my dataset with the related data, but appearently I had it filled a little to late, the grid was already rendered when I filled my dataset. I moved the code from the load event to the constructor and all is fine again.



  • Henri20

    Thanks. Can you create a small repro of this problem maybe using the Northwind database  I tried this myself and I didn't hit any problems, so I want to see if there is something different with your scenario.

    Thanks!
    -mark
    Program Manager
    Microsoft
    This post is provided "as-is" 

  • apex1

    What are the values of the DisplayMember and ValueMember properties for your combobox column

    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

  • Jiming

    Should work but it does not. Bindingsource2 contains all the values for the field that the comboboxcolumn is bound to...

    When I change it from combobox to textbox, it lists the values correctly from BindinSource1...
    And these values are all included in Bindingsource2...

    hope this helps... I dont really understand what is going on here...

  • DanTheStan

    Glad to hear you've figured it out!

    thanks,
    -mark
    Program Manager
    Microsoft
    This post is provided "as-is"

  • Dmitry.K

    I figured out the problem with mine.  I hadn't filled the tableadapter for the users table.

  • frussell69

    That should work. Does the Bindingsource2 contain all the values for the field that the comboboxcolumn is bound to  For example, if you change from a ComboBoxColumn to a TextBoxColumn and run your application, do the values listed in this column all exist in the datasource that bindingsource2 is bound to  They must (except for null).

    Let me know and hopefully we can find out where the bug is at.

    thanks,
    mark
    Program Manager
    Microsoft
    This post is provided "as-is"

  • KurtH

    Displaymember is set to a field on BindingSource2 and valuemember is set to another one on Bindingsource2... These fields are typical lookup fields. One contains a number and the other contains the detailed description of the number...


  • the value of datagridviewcomboboxcell is invalid error