DataGridView Editable Checkbox & Numeric Formatting

0
0

I am building a grid that is really working like a spreadsheet and I need different editable cells in the same column. I can make it work using other questions here but I have two issues;

  1. The editable Checkbox leaves the cell checkbox in place while the CheckBox control is displayed – looks less than bad.
  2. The thousands separator and decimals places don’t format for numeric cell

I’ve tried all sorts to make it work how I need it and haven’t managed it. I’m sure the solution is probably staring at me.

I’ve made a quick project to show the issue – it’s a mish-mash of code from the application I’ll be using it in. I’ve uploaded it.

  • You must to post comments
0
0

You can use any custom editor in any cell, like you did. In that case you are taking over the editing control (Editor). Remember to dispose the one you create otherwise they will be disposed by the GC which may happen much later and the controls pile up on the client. If you want your control to cover the cell set Dock=Fill and set the background.

Another way it to use the built in cell editors. In Wisej you can assign cells of different types regardless of the column type. Look at the PropertyGrid, it can edit any value type in the value column. That’s a DataGridView inside the PropertyGrid. Simply use DataGridViewColumn and then assign DataGridViewCheckBoxCell, or DataGridViewDateTimeCell to the cells. You can also create your own cell types and cell editors.

  • Neil Hoskins
    Luca – thank you, I’ve been struggling with this for too long. I now have the Checkbox cells (and others) editing fine, For numbers and dates I have to use my own editing controls, but so much better now. I still don’t know why, when you set a 2 decimal place numericupdowncell value to 12.12345, it’s not rounded, but I can deal with that more easily.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.