Subject: This is driving me nuts...
Posted By: Klesk Post Date: 1/27/2006 3:57:23 AM
Good day fellas, and ladies. I have quite a big problem on my hands, and I'm lost for a sollution. Can't find anything on the net to help me either... Perhaps somebody here could provide me with some assistance, I would appreciate it.

Alright, I'm getting the following error : An unhandled exception of type 'System.StackOverflowException' occurred in system.windows.forms.dll

I have a user control with a tab control on it. Each tab has a chart (TeeChart) on it. There is a total of 5 tabs. The whole application works perfectly, except for when I click on the final tab in runtime.
Then the error occurs. The code breaks in...
[STAThread]
        static void Main()
        {
            Application.Run(new Form1());
        }


Form1 is simply a test environment for my user control.
I wish I could post code, but what code should I post? Considering that the exception occurs when I click on a tab. There are no events triggered when I click on a tab.

To give a little bit more information. I have a seperate class for each Chart (displayed on it's own tab.) Each chart inherits from an abstract chart class. Additionaly I have a Charts class which is a collection of all the charts, and does the initialising and so forth.
Each chart class listens to events on the user control, basically it detects text box changes and updates the charts accordingly. As I said though, the error occurs when clicking on the final tab, all other things happen smoothly.

Please tell me that somebody has an idea of why this is happening.
Thanks in advance.

Reply By: Ankur_Verma Reply Date: 1/27/2006 5:35:35 AM
The exception most probably is being thrown by the user control code, which, in the
absence of any local exception handler, is getting promoted as an application level
exception. I believe the problem lies in the user control and that too in the code
that initialized the chart on the last tab. You must be assigning the fields of your
chart Objects some values based on which the chart is prepared. The fields of the
chart object on the last tab is being assigned a value that is either not in correct
format, is out of acceptable range or has some problem which makes it unacceptable as
a value for the felids of chart object on the last tab.

Try enclosing the initialization code of the last tab in try catch to see whats
The problem there or if the problem is indeed there.

Regards
Ankur Verma
Reply By: Klesk Reply Date: 1/27/2006 6:13:10 AM
Thanks for the reply. I already have try{}catch{} blocks around relevant code.
The problem is that no code executes when the tab is clicked. I went a step further and attached an eventhandler to the tabcontrol's index change. It runs through this code fine. All that happens during this operation is that the tab index changes, and the TeeChart control is displayed. I can only think that the error is generated within the charts "draw" code. Over which I have no control offcourse. I will have to further pursue this problem with the creators of the chart it would seem. Thanks again for the advice.

Reply By: arielote Reply Date: 1/27/2006 5:51:37 PM
I've got similar error in other kind of application.
Please before draw anything to a graph check the data that the chart are going to receive.
Probably you are going to read a database, you have to be sure that the data gathered are valid and same kind that the chart are expecting.

I would show tables (grids??) to show me the information and to debug the application.
When I'll be sure about this, I would pass this info to chart objects.

Sorry if I missunderstood your problem, but I tried to help you

Ariel

---
Ariel Folonier
San Nicolas
Argentina

Go to topic 39254

Return to index page 384
Return to index page 383
Return to index page 382
Return to index page 381
Return to index page 380
Return to index page 379
Return to index page 378
Return to index page 377
Return to index page 376
Return to index page 375