Out of range exception with a Tab Control

Out of range exception with a Tab Control

Post by Derrick Re » Wed, 31 Dec 2003 08:27:00


Hi,

I have a standard TabControl on a form that has five tabs. The first tab
has a list box from which "available" elements can be selected and moved
into an Infragistics grid of "Selected" elements. This mimics a standard
"pick list" form, and has buttons that will

1. Move All Available Elements To the Selected grid
2. Move Highlighted Available Elements To the Selected grid
3. Remove Highlighted Elements from the Selected grid
4. Remove All Elements from the Selected grid

The form works fine, and all elements can be individually or collectively
moved to the Selected grid or back to the Available list box. I am able to
make selections, select any other tab (there are five tab pages defined in
this tab control), and move back to the original "pick list" tab with no
issue.

The issue arises when I have moved all of the elements into the Infragistics
grid, select any other tab, and try to return to the "pick list" tab. The
following error is thrown (I have added "***" markers for clarity):

*** Start of Error Trace ***

Specified argument was out of the range of valid values.
Parameter name: '0' is not a valid value for 'value'.
Of Type: System.ArgumentOutOfRangeException
Stack Trace:
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.TabPage.set_Visible(Boolean value)
at System.Windows.Forms.TabControl.UpdateTabSelection(Boolean uiselected)
at System.Windows.Forms.TabControl.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32
width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TabControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

*** End of Error Trace ***

I have no idea how to track the actual error, as it seems to be totally
contained within the System.Windows.Forms.dll and is not actually generated
by my code. However, there IS something in the way the tab is populated
that is causing this error and, if I can just figure out what is set
improperly, the error should go away. I have wrapped every method in the
form with a Try ... Catch block to try to handle the exception, but it
remains unhandled (and frustrating!).

Any ideas? I appreciate your suggestions!

Regards,
Derrick
 
 
 

Out of range exception with a Tab Control

Post by Derrick Re » Thu, 01 Jan 2004 00:17:37

Additional information:

As a test, I replaced the System.Windows.Forms.TabControl with an
Infragistics .NetAdvantage (v3) UltraWinTab. When I ran the app again, here
is the error that was generated:

Specified argument was out of the range of valid values.
Parameter name: '0' is not a valid value for 'value'.
Of Type: System.ArgumentOutOfRangeException
Stack Trace:
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at
Infragistics.Win.UltraWinTabControl.UltraTabPageControl.set_Visible(Boolean
value)
at
Infragistics.Win.UltraWinTabControl.UltraTabControlBase.OnManagerSelectedTab
ItemChanged(Object sender, SelectedTabItemChangedEventArgs e)
at Infragistics.Win.UltraWinTabs.TabManager.set_SelectedTabItem(ITabItem
value)
at Infragistics.Win.UltraWinTabs.TabManager.TabClick(ITabItem tab)
at
Infragistics.Win.UltraWinTabs.TabItemUIElement.OnMouseDown(MouseEventArgs e,
Boolean adjustableArea, UIElement& captureMouseForElement)

This tells me that it's not the tab itself that is causing the issue, but a
control on the tab. I will keep trying to identify the issue, but any
debugging help would be appreciated.

Thanks,
Derrick