Datagridview validating edit
For example, you might programmatically resize all columns immediately after loading data, or you might programmatically resize a specific row after a particular cell value has been modified. Get Preferred Width() methods or by calling protected resizing method overloads in a derived Data Grid View control. You will typically call the programmatic resizing methods at specific times. In this case, size adjustment occurs whenever cell contents change. You can also configure rows, columns, and headers to automatically adjust their sizes to fit their cell contents. The enumerations used by sizing properties and methods have similar values for content-based sizing. You must then call the Auto Resize Columns method to adjust the column widths to the calculated ideal. When automatic sizing is disabled, you can programmatically set the exact width or height of rows, columns, or headers through the following properties: These methods will resize rows, columns, or headers once rather than configuring them for continuous resizing.
If content-based automatic sizing is enabled for one dimension only—that is, for rows but not columns, or for columns but not rows—and Wrap Mode is also enabled, size adjustment also occurs whenever the other dimension changes. For more information about this mode, see the Column Fill Mode section below. Column fill mode causes the visible columns in the control to fill the width of the control's display area. For example, if you call the Auto Resize Rows(Data Grid View Auto Size Rows Mode, Boolean) overload of the Auto Resize Rows method and pass in a value of false for the Boolean parameter, the overload will calculate the ideal heights and widths for cells in the row, but it will adjust the row heights only.
You can customize sizing behaviors when working with derived Data Grid View cell, row, and column types by overriding the Data Grid View Cell. The protected resizing method overloads are designed to work in pairs to achieve an ideal cell height-to-width ratio, avoiding overly wide or tall cells. I hope the question is understandable as I am not familiar with all the correct terms yet and as English isn't my first language.