IndexOutOfRangeException

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ianbaskerville
Newbie
Newbie
Posts: 2
Joined: Mon Jun 18, 2007 12:00 am
Location: Texas

IndexOutOfRangeException

Post by ianbaskerville » Fri Jul 20, 2007 12:47 am

Received the error with the message 'Index was outside the bounds of the array'.
My application is unable to trap the error and closes.

The top of the call stack is:
TeeChart.dll!Steema.TeeChart.Styles.ValueList.this[int].get(int index = 1) + 0x21 bytes
TeeChart.dll!Steema.TeeChart.Styles.Series.CalcXPos(int index = 1) + 0x2c bytes
TeeChart.dll!Steema.TeeChart.Styles.Shape.GetShapeRectangle() + 0x114 bytes
TeeChart.dll!Steema.TeeChart.Styles.Shape.Clicked(int x = 217, int y = 108) + 0xb2 bytes
TeeChart.dll!Steema.TeeChart.Styles.Series.Clicked(System.Drawing.Point p = {X = 217 Y = 108}) + 0x39 bytes TeeChart.dll!Steema.TeeChart.Chart.CalcNeedClickedPart(System.Drawing.Point Pos = {X = 217 Y = 108}, bool Needed = true) + 0x17b bytes
TeeChart.dll!Steema.TeeChart.Chart.DoMouseDown(bool IsDoubleClick = false, System.Windows.Forms.MouseEventArgs e = {X = 217 Y = 108 Button = Left}, System.Windows.Forms.Keys Shift = None) + 0xdf bytes
TeeChart.dll!Steema.TeeChart.TChart.OnMouseDown(System.Windows.Forms.MouseEventArgs e = {X = 217 Y = 108 Button = Left}) + 0x86 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseDown(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0xe2 bytes

I received this by:
1. Create a chart.
2. Added 8 shape series (lines). No other series.
3. Removed all the series with RemoveAllSeries. (Also tried RemoveAt for each and Clear(true)).
4. Added 8 new shape series (lines).
5. Clicked on one of the series.
Bang! the error occurs.

Note: all this processing, except the click, was done programmatically.

Ian.

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Fri Jul 20, 2007 8:39 am

Hello Ian!

Here It's working fine using lastest release (Build 3.2.2746.19160 "available at the web"). Which TeeChart version are you using? Could you please try with the last version? If the problem persist could you please send us a simple example project we can run "as-is" to reproduce the issue here?

You can post your files either at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup or at our upload page

Please let us know when you have posted the sample project.

Thanks in advance
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

ianbaskerville
Newbie
Newbie
Posts: 2
Joined: Mon Jun 18, 2007 12:00 am
Location: Texas

IndexOutOfRangeException: Getaround

Post by ianbaskerville » Fri Jul 20, 2007 1:27 pm

I am using the most recent version.

However, I have managed to prevent the error.

One thing I did not mention (did not think it would matter), is that the Chart is encapsulated on an inherited panel control.

I added a panelGraph.Refresh() call to the event handler that removes and reloads the shapes. The next user click on a shape now does not generate an error.

Additionally, I specified:
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
before the Application.Run(...) call. Once the user responds to the (ugly) exception message dialog to Continue, the next shape click did not generate an error.

So, the error appears to have occurred because the Chart was not automatically being refreshed.

Post Reply