Possible work-around for DatagridView bug

This is a link to a work around to the reentrant issue on a win forms DataGridView.

The reentrant issue raises it’s head when changing data in a DataGridView. InvalidOperation exceptions get raised a random time after the grid is changed. This implies that the DataGridView uses threads in the background yet it’s public methods are not thread-safe.

In order to solve this you should use the best practice of subclassing the UI controls and put the fix there.

Theoretically you should subclass all controls (see here) – but if pushed for time just do the complex ones (how many times will you bugfix a label?) or the subset that you use frequently – any app will mostly use 10 or so basic controls.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s