Try the attached sample. It shows how to dynamically create a cell editor and how to store the custom value in the cell. It displays 10 columns and 1000 rows and creates 5 different cell editors on different rows: DateTimePicker, ComboBox, NumericUpDown, TrackBar and TextBox with auto suggest list.
The sample is somewhat rudimentary since it creates a new editor each time edit mode is started. You can cache editors or create new ones according to your requirements.
You can also assign the Column.Editor property only once instead of recreating the editor each time.
Additionally, if your editor implements the IDataGridViewEditingControl interface you don’t have to store the custom value in EndEdit.
I was having real trouble getting a non-bound DataGridView working with rows of different data types, working almost as a Property Grid (couldn’t use a Property Grid as it’s not as user friendly and 100 times more complicated to set up, not easily extendible at run time etc.). No TypeConverters, custom controls etc. required – thank you Luca!
Thanks it worked!
Please login first to submit.