Index was out of range. Must be non-negative and less than the size of the collection. – On close form – DataGrid column

When closing a Windows Form on a button using Me.Close then get the following:

Error

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Solution

Tabs with Detail and List using a DataGridView, both

Had switched a BindingSource from a data table to a data source (object) which used a different field, so the DataGridView lookup column now had an invalid column.

Change to new column name and it will work.

End.

 

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: