Datagridview cell validating
Automatic sizing does not occur when visibility changes, so changing the column Visible property back to true will not force it to recalculate its size based on its current contents. For example, if a column is hidden after it is automatically sized to fit a large cell value, the hidden column will not change its size if the row containing the large cell value is deleted. 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. Programmatic content-based resizing affects rows, columns, and headers regardless of their visibility.
For maximum performance, use programmatic resizing instead so that you can resize at specific times, such as immediately after new data is loaded.
When you programmatically resize columns that have Inherited Auto Size Mode property values of Fill, however, the calculated content-based widths are used to proportionally adjust the column Fill Weight property values, and the actually column widths are then calculated according to these new proportions so that all columns fill the available display area of the control.
The new sizes are automatically calculated to display all cell contents without clipping.
But, I can't get it to validate all cells when a button is pressed.
I tried calling Validate() but it's not calling the Cell Validating function on every cell Why would you want it to force validation for all cells?
Search for datagridview cell validating:
When a cell is modified in any way it is automatically marked as "dirty", when you call data Grid. Validate() you are telling to to check all of the cells which have been modified! If you are saying that this is not happening correctly, or you still want to bypass this great, amazing, fantabulous feature let us know!