I am experiencing an odd issue when my form is minimized. Upon activation,
my form refreshes some data within a DataGrid control. No exception is
thrown until the form is minimized, then restored from the task bar. Upon
restore, an exception is thrown in the Activated event. The exception is as
follows:
System.ArgumentException: '0' is not a valid value for 'value'. 'value'
should be between 'minimum' and 'maximum'.
at System.Windows.Forms.ScrollBar.set_Value(Int32 value)
at System.Windows.Forms.DataGrid.SetDataGridTable(Dat aGridTableStyle
newTable, Boolean forceColumnCreation)
at System.Windows.Forms.DataGrid.TableStylesCollectio nChanged(Object
sender, CollectionChangeEventArgs ccea)
at
System.Windows.Forms.GridTableStylesCollection.OnC ollectionChanged(Collectio
nChangeEventArgs ccevent)
at System.Windows.Forms.GridTableStylesCollection.Cle ar()
at MyProject.frmMyForm.FormatGrid()
at MyProject.frmMyForm.MyForm_Activated()
The exception occurs on a line of code that simply clears all TableStyles
from the DataGrid object (frmMyForm.MyDataGrid.TableStyles.Clear). Any ideas
as to why this only occurs when the form is restored from being
minimized?
--
Scott Adams
~~ not the Dilbert guy ~~
~~ not the creator of the Adventure series ~~