Exception on Form restore

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scott Adams

    #1

    Exception on Form restore

    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.Argument Exception: '0' is not a valid value for 'value'. 'value'
    should be between 'minimum' and 'maximum'.
    at System.Windows. Forms.ScrollBar .set_Value(Int3 2 value)
    at System.Windows. Forms.DataGrid. SetDataGridTabl e(DataGridTable Style
    newTable, Boolean forceColumnCrea tion)
    at System.Windows. Forms.DataGrid. TableStylesColl ectionChanged(O bject
    sender, CollectionChang eEventArgs ccea)
    at
    System.Windows. Forms.GridTable StylesCollectio n.OnCollectionC hanged(Collecti o
    nChangeEventArg s ccevent)
    at System.Windows. Forms.GridTable StylesCollectio n.Clear()
    at MyProject.frmMy Form.FormatGrid ()
    at MyProject.frmMy Form.MyForm_Act ivated()

    The exception occurs on a line of code that simply clears all TableStyles
    from the DataGrid object (frmMyForm.MyDa taGrid.TableSty les.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 ~~



Working...