[ NYXY @ 24.04.2007. 11:52 ] @
Kada pokušam pokrenuti aplikaciju javi mi se ovaj error:

An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll

aplikacija se sastoji od 2 forme

forma 1:
Code:

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked Then
            TextBox1.Text = 1
        ElseIf RadioButton2.Checked Then
            TextBox1.Text = 2
        ElseIf RadioButton3.Checked Then
            TextBox1.Text = 3
        End If

    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked Then
            TextBox1.Text = 2
        ElseIf RadioButton1.Checked Then
            TextBox1.Text = 1
        ElseIf RadioButton3.Checked Then
            TextBox1.Text = 3
        End If
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        If RadioButton3.Checked Then
            TextBox1.Text = 3
        ElseIf RadioButton2.Checked Then
            TextBox1.Text = 2
        ElseIf RadioButton1.Checked Then
            TextBox1.Text = 1
        End If

    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        fo2.Show()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


forma 2:
Code:

Public Class Form2
    Dim Fo1 As New Form1()
Private Sub Text2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Text22.Text = Fo1.Text2.Text
End Class

    End Sub



Unaprjed vam hvala
[ mmix @ 24.04.2007. 13:09 ] @
StackOverflowException je obicno indikator nekotrnolisane rekurzije. Mnogo bolji indikator sta se desava je stack trace. Vidi sta ti je na steku u trenutku pucanja i baci prvih desetak linija ovde...
[ NYXY @ 24.04.2007. 19:33 ] @
Cini mi se da je error bio zbog one linije koda:
Code:

 Dim Fo1 As New Form1()

prvo sam mislio da je to zbog ona 4 textboxa koja komuniciraju međusobno (po 2 u svakoj formi),ali kada sam ih izbrisao javio se isti error,nakon što sam uklonio gorenavedenu liniju koda program je radio bez problema.
[ mmix @ 24.04.2007. 21:13 ] @
Ako i u okviru Form1 imas liniju koda:

Dim fo2 as New Form2

onda je to rekurzija. (form1 kreira form2 koji kreira form 1 koji kreira form2 i tako doveka tj dok ne dodje <stack overflow>)

PS> Ovo se sve vidi u stack trace-u. Jos nisam video stack overflow koji nije mogao da se dijagnostikuje kroz stack trace, iz aviona se vidi mrtva petlja.