Custom cell editor in DataGridView

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
Answered
0
0

Hi,

is it possible to set custom cell editor dynamically on runtime ?

Best,

Alexander

  • You must to post comments
Best Answer
1
0

Hi Alexander,

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.

HTH

Best,

Luca

 

  • You must to post comments
0
0

Thanks it worked!

  • You must to post comments
Showing 2 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json