Add combobox to datagridview from designer

SteveInBeloit

Well-known member
Joined
May 22, 2006
Messages
132
Programming Experience
10+
HI,
I have a form with two datagridviews. I am adding a column to the second datagridview. I went to Edit Columns and clicked add, and set it as type comboBox.

For the data properties:

DataPropertyName: the column in the datagridview table that corresponds to the column in the other table I want to get the value from.
DataSource: drilled down to Other Data sources, project data source, then my databse, then clicked on the table I want to look the values up in.

displaymember: the actual description I want the user to see from the table above.

valuemember: the column in the table from above, not from the datagridview


when I run it, I get a system.formatException: DatagridviewcomboBox cell value is not valid

any thoughts?
 
TWIMC,
I noticed that all my tests in separate projects work, so I deleted the dataset.xsd, and went through the New Data Source wizard, and everything worked after that. I guess just hitting the Refresh on the datasource tab or going through the "Configure" isn't enough?
 
Last edited:
Does your final post indicate you have found a solution?

In answer to the most recently asked question, I usually find that reconfiguring the SQL will update the relevant datatable schema, but not in all cases. This is one thing I check after reconfiguring a tableadapter's primary select SQL
 
Last edited:
This may have been one of those cases where it did not. But the combo box now works after deleting the .xsd and re-adding the datasource. Geeze, I lost days over this, but I guess that happens. I learned a ton while researching to see what I may have been doing wrong.

I am skeptical now just to do the re-configure in the future, knowing that it may not always get what I need.

Thanks for checking on this. Is there a way to mark a thread Resolved?

Steve
 
I am skeptical now just to do the re-configure in the future, knowing that it may not always get what I need.
Well, put it this way; computers are good, but asking if they can think is like asking if a submarine can swim.. I dont have a problem repeatedly re-configuring datasets after changing a datasource, but that doesnt mean I can tell you exactly what is wrong with what youre doing; it's more involved than that, and involves checking.. Basically, you really must check whatever it is that you change. If you make a column wider, check that the MaxLength has changed after the reconfigure. If it hasnt, change it yourself. If you change a datatype, then likewise..

Sometimes if you have changed a lot, and the TA has no other custom queries than the 4 main (S/I/U/D) ones, it can be quicker and easier to just delete it and drag it in again..

Thanks for checking on this. Is there a way to mark a thread Resolved?
As a mod on another board that uses the same BB software as here, I know i can click the THREAD TOOLS menu above the first port, and choose "mark as resolved"
You MAY be able to do the same, because you are the OP. When I tried, I didnt see the option. Give it a shot?
 
Back
Top