Convert TextBox to a ComboBox in a DataGridView

Funger

Member
Joined
Dec 15, 2006
Messages
8
Programming Experience
5-10
Hi All,

I have a DataGridView control. When editing a row in it, I need the user to be able to select a value from a combo box. When the user is not editing a row, however, I need the column to display data that is potentially NOT in the list of items in the combo box.

There were two different solutions that I came up with, although I know how to do neither. I would also be open to any other solution that you guys can offer.

The first solution that I came up with (but again, have no idea how to accomplish) was to have the column be based on the TextBox column and when the user was editing the cell, somehow change it to a dropdown, and then process the value that the user selected when they moved off of the cell.

The second solution that I thought was possible was to somehow make VB allow and display values in the column that were not in the combobox items. This is the solution that seems the most likely to succeed, but again I have no idea how to do it. As soon as I bind data to the ComboBox column, it seems to not want to display items that are not in the combobox, and throws an error when I attempt to do so.

I would appreciate any help in this issue!

Thanks in advance!

-Funger
 
Back
Top