Results 1 to 2 of 2

Thread: [vs 2005] Rather Odd issue

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    [vs 2005] Rather Odd issue

    I am using vs 2005 compact framework. For the life of me I could not remember what order the form's methods go. I am trying to make an array of forms so that users can move back and forward using shortcut keys....anyways here is the code I ran:
    Code:
    Private Sub FrmMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
            MsgBox("Activated")
        End Sub
    
        Private Sub FrmMain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
            MsgBox("Click")
        End Sub
    
        Private Sub FrmMain_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
            MsgBox("Closed")
        End Sub
    
        Private Sub FrmMain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
            MsgBox("Closing")
        End Sub
    
        Private Sub FrmMain_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate
            MsgBox("Deactivate")
        End Sub
    
        Private Sub FrmMain_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Disposed
            MsgBox("Disposed")
        End Sub
    
        Private Sub FrmMain_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.DoubleClick
            MsgBox("DoubleClick")
        End Sub
    
        Private Sub FrmMain_EnabledChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.EnabledChanged
            MsgBox("EnabledChanged")
        End Sub
    
        Private Sub FrmMain_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.GotFocus
            MsgBox("GotFocus")
        End Sub
    
        Private Sub FrmMain_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.HandleCreated
            MsgBox("HandleCreated")
        End Sub
    
        Private Sub FrmMain_HandleDestroyed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.HandleDestroyed
            MsgBox("HandleDestroyed")
        End Sub
    
        Private Sub FrmMain_HelpRequested(ByVal sender As Object, ByVal e As System.Windows.Forms.HelpEventArgs) Handles MyBase.HelpRequested
            MsgBox("HelpRequested")
        End Sub
    
        Private Sub FrmMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
            MsgBox("KeyDown")
        End Sub
    
        Private Sub FrmMain_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
            MsgBox("KeyPress")
        End Sub
    
        Private Sub FrmMain_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
    
        End Sub
    
    
        Public Sub FrmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            MsgBox("Load")
    
            'Set/Show UserName that Logged In
            UserLabel.Text = "Main Menu: " + GV.UserName
        End Sub
    
           Private Sub FrmMain_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.LostFocus
    
        End Sub
    
        Private Sub FrmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            MsgBox("Paint")
        End Sub
    
        Private Sub FrmMain_ParentChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ParentChanged
            MsgBox("ParentChanged")
        End Sub
    
        Private Sub FrmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
            MsgBox("Resize")
        End Sub
    
        Private Sub FrmMain_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Validated
            MsgBox("Validated")
        End Sub
    
        Private Sub FrmMain_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Validating
            MsgBox("Validating")
        End Sub
    End Class
    After running the program as is, I got a stackoverflowexception on FrmMain_Activated. Any ideas why???

    Thanks,

    D
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: [vs 2005] Rather Odd issue

    Hi,
    using msgbox is probably causing form events to fire, which create msgbox, which cause events to fire.....


    I know in VB6 this was documented, but I haven't seen it in .Net, possibly, because depending on events, it could change.

    If you are trying to let the users move between forms, you can load them up, and hide them, (dim frmx as new form1:frmx.show etc) but it wouldn't be the best use of memory.

    Have you considered using panels?

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

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