Results 1 to 2 of 2

Thread: Error Showing Forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Location
    York, UK
    Posts
    2

    Error Showing Forms

    Can anyone help with this problem plz...

    I'm trying to display / hide forms but I keep coming up with an error.

    Here's the code:

    frmMain.vb
    Code:
    Public Class frmMain
        Inherits System.Windows.Forms.Form
        Dim LoginForm As New frmLogin
    
        Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
            Me.Close()
        End Sub
    
        Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
            Me.Hide()
            LoginForm.Show()
        End Sub
    frmLogin.vb
    Code:
    Public Class frmLogin
        Inherits System.Windows.Forms.Form
        Dim MainForm As New frmMain
    
        Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
            Me.Hide()
            MainForm.Show()
        End Sub
    End Class
    When I try to run this code I get no compile errors, but then I get a "Just-In-Time Debugging" pop-up, with the error: "An exception 'System.StackOverflowException' has occurred".

    I'm really stuck on this now so any help would be great.

    TIA MJM
    .Net Noob
    C++ Is My Specialty

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2004
    Location
    York, UK
    Posts
    2
    Never mind, I figured it out myself after a while

    MJM
    .Net Noob
    C++ Is My Specialty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width