Results 1 to 9 of 9

Thread: [RESOLVED] Hopefully an easy question

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Resolved [RESOLVED] Hopefully an easy question

    I have 2 forms, for example: FormA & FormB. The code in FormA might look like this:

    Code:
    	FormB.Show()
            Me.Hide()
    When I use this code (VB6-like), it calls up FormB and then the program ends. If I comment out the me.Hide() it works, but FormA is still showing. I only want FormB to be showing.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  2. #2
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Hopefully an easy question

    If I do:

    vb Code:
    1. Me.Hide()
    2.         Dim form As New Form()
    3.         form.Show()

    In a button click on the form (after it's loaded) then it works perfectly.

    If you're doing it on the FormA_Load() then it's doesn't seem to do as well. Might have to pass
    a ref of the form to the FormB in it's constructor and have a thread to check if FormA's handle has been created, if so invoke FormA's close method through a delegate maybe?

    But you might see it flash and then go away : /. Only way I can think of doing it without googling it

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  3. #3

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Hopefully an easy question

    Actually, the code is in a button_click event:
    Code:
    Private Sub cmdParts_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdParts.Click
            frmMainMenu.Show()
            Me.Hide()
        End Sub
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Hopefully an easy question

    check your application properties.. . I susepect that the option to control when the app end is set to the "When Startup Form Closes" .... so when you close form1, which I'm presuming is your startup form, it's firing off the app close. Change it to "When all forms are unloaded" or something to that effect.

    Otherwise your code is fine.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Hopefully an easy question

    That was it! I feel dumb, but I knew it had to be something simple like that. I just couldn't see it.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

  6. #6
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: [RESOLVED] Hopefully an easy question

    Mine are set to when the start form closes as well. Me.Hide() equates to Me.visible = false right?
    Maybe try to put the Me.Hide() before the showing of the new form. I would be surprised if it made a difference, but maybe.

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  7. #7
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: [RESOLVED] Hopefully an easy question

    "When last form closes"


    I have never turned on the framework either .

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: [RESOLVED] Hopefully an easy question

    I forget about quite often initially too... that's why this time I recognized the symptoms and it was the first thing that came to mind. Funny how that works.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  9. #9

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: [RESOLVED] Hopefully an easy question

    I'm glad it was so easy. I was beginning to question my move to VS2008 if something like this was throwing me.
    ===================================================
    If your question has been answered, mark the thread as [RESOLVED]

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