Results 1 to 4 of 4

Thread: silly question concerning Forms

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    3

    Unhappy

    Lets say I want to go from Form1 to Form2 via Next button
    I try to
    Private Sub cmdNext_Click()
    Unload Form1
    Load Form2
    End Sub

    But only form1 unloads and nothing else happens

    Please help a newbie

  2. #2
    Guest
    Use this. Form2.Show

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Show the form.

    When you Load a Form, the Load Subroutine is invoked. In that subroutine, you should request that Form be shown (Use "Form1.Show" if "Form1" is name of your Form).

    I think you can show the form without loading it (VB will load it automatically), but this is not a good idea. There are usually some things you want to do when form is loaded, so you will want to write Code in the Load Subroutine. Start with just "Form1.Show" as the only code, and go on from there.

    VB sets TabIndex Values in the order you put Controls on the Form. You can override these values at Design Time, but it tends to be more convenient to do it at Run Time in the Load Subroutine. There are various other initializations conveniently taken care of in the Load Subroutine.

    Good luck with VB
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb May be you can just Hide the Form

    You also can do it in this way too

    Code:
    Private Sub cmdNext_Click() 
    Form1.Hide 
    Form2.ShoW 
    End Sub 
    
    Private Sub cmdNext_Click() 
    Form1.Show 
    Form2.Hide 
    End Sub

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