A recent project caused me grief until it dawned on me what the problem and the fix was. The GridView has a height property value and if it’s changed from the default (which is NULL), or to anything less than 25px (arbitrary number) you may experience an undesierable result where the GridView will vertically align the rows in the middle of the control. I did this inadvertantly, creating this undesireable result, and I wanted to share with you the fix and why does this. Continue reading
There’s a problem when editing the DataGridView.
Problem: The pencil glyph icon in edit mode wouldn’t go away. Here’s the situation and the solution.
Solution: If the property Virtual is set to false the glyph will go away, period.
Even after doing this, a call to the EndEdit() function wasn’t required to make the glyph go away even though other people say that it’s required. Test it though to make sure. Suffice it to say that if you’re still having a problem after setting the Virtual property, then it’s something with the grid property settings or the programmatic overrides you’re doing. But this setting worked for me.
Any additional comments or concerns about this?
An application I wrote to compare values in the rows of two datagridviews, set side-by-side, will hide rows if no difference is found; which then leaves just the rows that are different. Simple enough, but an error was thrown when one of the grid’s cells was active. This is the error.
Row associated with the currency manager's position cannot be made invisible.
The solution is to put the following command somewhere at the top of your routine before accessing the grid rows (C# code).
<DataGridView>.CurrentCell = null
Hope this helps.
Well, something stumped me. But figured it out … As part of my C# console application, I wanted to print out the version (Major.Minor.Revision) as part of the help output so I could know the release details. And without the Application object, I just wanted the simple information from the build assembly. Continue reading