Results 1 to 5 of 5

Thread: Closing a form when another one opens

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2014
    Posts
    32

    Closing a form when another one opens

    Hey everyone, I am having trouble closing one form when another one opens in Visual Basic. Can anyone help me with this?

  2. #2
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,148

    Re: Closing a form when another one opens

    Can you provide more details..
    what trouble are you facing?

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2014
    Posts
    32

    Re: Closing a form when another one opens

    Private Sub radNFLLeaders_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radNFLLeaders.CheckedChanged
    If radNFLLeaders.Checked Then
    Dim frmNFLLeaders As New frmNFLLeaders
    frmNFLLeaders.Show()
    frmNFLMVP.Close()

    End If
    End Sub

    When the form NFLLeaders opens, I want the form NFLMVP to close

  4. #4
    Hyperactive Member
    Join Date
    Jun 2014
    Location
    Lahore, Pakistan
    Posts
    450

    Re: Closing a form when another one opens

    A little mistake is in the code:

    Code:
    Private Sub radNFLLeaders_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radNFLLeaders.CheckedChanged
    If radNFLLeaders.Checked Then
    Dim frmNFLLeaders As New frmNFLLeaders
    frmNFLLeaders.Show()
    frmNFLMVP.Close()
    
    End If
    End Sub
    Use the code this way:

    Code:
    Private Sub radNFLLeaders_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radNFLLeaders.CheckedChanged
    If radNFLLeaders.Checked = True Then
    Dim frmNFLLeaders As New frmNFLLeaders
    frmNFLLeaders.Show()
    frmNFLMVP.Close()
    
    End If
    End Sub

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: Closing a form when another one opens

    It's not a mistake... either is acceptable.

    But it's still not clear on what the problem is... What happens that shouldn't? What's not happening that should? Do you get an except? Of just unexpected results. Remember only you can prevent office fires, and we're not sitting in your lap (I should HOPE NOT!) so we don't see what you see ... or we don't see what you don't see... does that mean we should see it? Anyways, point is we need you to provide a CLEAR and descriptive narrative of the problem at hand.

    -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??? *

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