OnLoad
(
EventArgs e
)
{
AssertValid();
base.OnLoad(e);
// Known DataGridView bug: Setting the AutoSizeMode of a column to
// Fill in the designer can cause this exception:
//
// System.InvalidOperationException: This operation cannot be performed
// while an auto-filled column is being resized.
//
// See the post "AutoResizeColumns gives operation exception" at
// http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/
// thread/b66520b7-94e4-4b13-ab82-64f3aeee23e4/.
//
// To work around this bug, set the AutoSizeMode property during the
// Load event.
this.colColumnName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
switch (lbxSourceWorkbook.Items.Count)
{
case 0:
this.ShowWarning(ExcelWorkbookListBox.NoOtherWorkbooks);
this.Close();
break;
case 1:
lbxSourceWorkbook.SelectedIndex = 0;
break;
default:
// (Do nothing.)
break;
}
}