Fatal Stack Overflow Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I'm working on a Q & A type program. Within every from is a question, and 2 to 8 possible answers that are radio buttons. click a radio button, it takes you to another question. I have 5 buttons in each form. The forms are inherited from the first form, that has no questiions or answers. It's just the form, and a quit button and start over button.
All the forms are basicly the same structure. I'm using the "close" method to close a previous window. Thought about using "finalise", not sure which one would be more effective. I left a sample of a form below. I have been running this program fine. But now, I probably have close to 75 forms. So when I run I get "An unhandled exception of type "System.Stackoverflow Exception" occured in QA.exe" I beleive stack overflows means I have too many pending method calls. I can't believe that I can't use this many windows. The program will end up with about 100 froms all together. Any suggestions to what the problem is, and is there a better way to manage my windows?

Public Class Form11b

Inherits Unity_Troubleshooter.BaseForm
Public myform11b As Form11b
Public myform12a As New Form12a
Public myform12b As New Form12b
Public myform2c As Form2C

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
If rbyes11b.Checked = True Then
Me.Close()
myform12a.Show()
ElseIf rb11bno.Checked Then
Me.Close()
myform12b.show()


End If
End Sub
Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click
Dim Help As String
Help = "Dummy, didn't put anything here yet!!!"
MsgBox(Help, MsgBoxStyle.Information)
End Sub

Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click

myform2c.Show()
Me.Close()
End Sub
End Class

TIA

Rudy
 
myform12a.Show()
Me.Dispose(true);

Abhijeet Dev

Finalize should never be called from inside ur code.. GC provides methods to
control the behaviour.

Rudy said:
Hi all,
I'm working on a Q & A type program. Within every from is a question, and
2 to 8 possible answers that are radio buttons. click a radio button, it
takes you to another question. I have 5 buttons in each form. The forms
are inherited from the first form, that has no questiions or answers. It's
just the form, and a quit button and start over button.
All the forms are basicly the same structure. I'm using the "close"
method to close a previous window. Thought about using "finalise", not sure
which one would be more effective. I left a sample of a form below. I have
been running this program fine. But now, I probably have close to 75 forms.
So when I run I get "An unhandled exception of type "System.Stackoverflow
Exception" occured in QA.exe" I beleive stack overflows means I have too
many pending method calls. I can't believe that I can't use this many
windows. The program will end up with about 100 froms all together. Any
suggestions to what the problem is, and is there a better way to manage my
windows?
Public Class Form11b

Inherits Unity_Troubleshooter.BaseForm
Public myform11b As Form11b
Public myform12a As New Form12a
Public myform12b As New Form12b
Public myform2c As Form2C

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext.Click
If rbyes11b.Checked = True Then
Me.Close()
myform12a.Show()
ElseIf rb11bno.Checked Then
Me.Close()
myform12b.show()


End If
End Sub
Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnHelp.Click
Dim Help As String
Help = "Dummy, didn't put anything here yet!!!"
MsgBox(Help, MsgBoxStyle.Information)
End Sub

Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnBack.Click
 
Thanks Abhijeet,

I tried your suggestion, but it didn't fix my problem. But I will us that method instead of close. I did notice if I remove "NEW" from the statements 'Public myform12a As New Form12a', it will launch. However, now I get an error fo "System.NullReferenceException" at my 'myform12a.show'. This happens even with your suggestion. The thing I don't understand that it was working fine when I was 30 forms into my program. I always checked every 5 to 10 forms to make sure it was working. And then I took a nite and added the rest of my forms, probably another 40. And now I get this
By the way, what do you mean by GC? Can you tell I'm new at this? LO
Again thanks for the tip

Rud

----- Abhijeet Dev wrote: ----

myform12a.Show(
Me.Dispose(true)

Abhijeet De

Finalize should never be called from inside ur code.. GC provides methods t
control the behaviour

Rudy said:
Hi all
I'm working on a Q & A type program. Within every from is a question, an
2 to 8 possible answers that are radio buttons. click a radio button, i
takes you to another question. I have 5 buttons in each form. The form
are inherited from the first form, that has no questiions or answers. It'
just the form, and a quit button and start over button
All the forms are basicly the same structure. I'm using the "close
method to close a previous window. Thought about using "finalise", not sur
which one would be more effective. I left a sample of a form below. I hav
been running this program fine. But now, I probably have close to 75 forms
So when I run I get "An unhandled exception of type "System.Stackoverflo
Exception" occured in QA.exe" I beleive stack overflows means I have to
many pending method calls. I can't believe that I can't use this man
windows. The program will end up with about 100 froms all together. An
suggestions to what the problem is, and is there a better way to manage m
windows
Public myform11b As Form11
Public myform12a As New Form12
Public myform12b As New Form12
Public myform2c As Form2
System.EventArgs) Handles btnNext.Clic
If rbyes11b.Checked = True The
Me.Close(
myform12a.Show(
ElseIf rb11bno.Checked The
Me.Close(
myform12b.show(
End Su
Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e A
System.EventArgs) Handles btnHelp.Clic
 
Back
Top