Results 1 to 13 of 13

Thread: Opening new forms.,,.,,.,,.,,.,,.,,

  1. #1

    Thread Starter
    Member Cahlel's Avatar
    Join Date
    Aug 2000
    Location
    Earth (I think)
    Posts
    63

    Question

    From withtin a form, how do you open a new form with the click of a button, please help....
    Wisdom is supreme, therefore get wisdom,
    though it costs all you have, get understanding.
    Proverbs 4:7

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    assuming the form is created

    Load frmYourForm
    frmYourForm.Show
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Member Cahlel's Avatar
    Join Date
    Aug 2000
    Location
    Earth (I think)
    Posts
    63

    Unhappy Well,, hmmmm

    Well, ok asume that the first form is called menu.frm and the second form is called menu2.frm, where would I put that code and how would the code go, (for loading when a button was clicked)
    Wisdom is supreme, therefore get wisdom,
    though it costs all you have, get understanding.
    Proverbs 4:7

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    weird naming convention? However...
    
    'any click event of any control on form menu.frm
      unload menu.frm
      load menu2.frm
      menu2.show
    
    'on form menu2.frm you would revers the order
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    Code:
    'Command1, I am assuming is the name of your button
    Private sub Command1_Click()
    
    menu2.Show
    'If you want to hide the first form, just use
    'menu1.hide
    'otherwise the menu2 form with be shown ontop of the first
    
    
    
    End sub


  6. #6
    Guest
    It's a good idea to use Unload when you want to get rid of the Form.

    Code:
    Unload Form1

  7. #7

    Thread Starter
    Member Cahlel's Avatar
    Join Date
    Aug 2000
    Location
    Earth (I think)
    Posts
    63

    Angry Ok, one more time

    Well, this is my code:

    Private Sub Command10_Click()
    Unload menu1.frm
    Load menu2.frm
    menu2.Show
    End Sub

    and this is the return code:

    Unload menu2.frm
    Load menu1.frm
    menu1.Show

    Now what did I do?! I get an error saying An object is required. Help?
    Wisdom is supreme, therefore get wisdom,
    though it costs all you have, get understanding.
    Proverbs 4:7

  8. #8
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    it should look like:

    Code:
    Private Sub Command10_Click() 
    Unload menu1
    Load menu2 
    menu2.Show 
    End Sub
    Leave off the .frm




  9. #9
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    'take the . out of your names
    call it frmMenu2 and frmMenu

    Private Sub Command10_Click()
    Unload frmMenu
    Load frmMenu2
    frmMenu2.Show
    End Sub

    and this is the return code:

    Unload frmMenu2
    Load frmMenu1
    frmMenu1.Show

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  10. #10
    Guest
    You could also set frmmenu2 to nothing, which would clear up any resources still running.

    Code:
    Unload frmMenu2 
    Set frmMenu2 = Nothing
    Load frmMenu1 
    frmMenu1.Show

  11. #11
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You don't even have to use Load frmMenu2 if it isn't loaded then frmMenu2.show will load it.

  12. #12
    Guest

    Thumbs up You probably are a bit confused over the Load and Show events

    Load

    frmMenu2.Load, stores the form in memory and executes the Load event of the form. It doesn't show on your desktop, but is waiting rearing to go.

    Show

    frmMenu2.Show, if not loaded previous executes the Load event and displays the form on your screen.

    Hide

    frmMenu2.Hide, the form is still in memory but is not displayed. generally used if you are going to re-display the form but want to keep it in memory.

    Hope that it clear.

  13. #13
    Guest
    Then you can use Unload to destory the Form and release it from memory.

    Code:
    Unload Form1
    Set Form1 = Nothing

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