Results 1 to 6 of 6

Thread: Unload Form1

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    Unload Form1

    I have form1 and form2.

    In Form1 load event I do this:

    dim aForm as new Form2
    aForm.Show

    I have a button in form2. I've tried;

    form1.close

    but this code doesn't work!

    please correct me.

  2. #2
    Junior Member
    Join Date
    Sep 2003
    Posts
    26
    does it recognize Form1 from Form2? Like in Form2 when you type Form1. does a list pop up as possible actions to take?

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    If Form1 is the startup form of your proj , and you used Close() method , it will close the application not the form . Use instead , Hide() or Visible() methods set to False .

  4. #4
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    In the form1 class , declare a private variable:

    Private aForm as Form2

    when you want to show form2 use:

    aForm = New Form2
    aForm .Show

    when you want to close the form use:

    aForm .Close

    Basically, aForm was out of scope, and obvously, in production code, you should use a more descriptive names than 'aForm ' and 'Form2';
    Last edited by PeteD; Sep 13th, 2003 at 06:58 PM.

  5. #5
    Member
    Join Date
    Sep 2003
    Location
    The United Kingdom
    Posts
    45
    Instead of

    From1.close

    try

    Unload Form1
    Please don't discourage me, I never hurt anyone.

    "You're watching FOX News channel, real journalism, fair and balanced." - Ha

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by MixMaster
    Instead of

    From1.close
    try
    Unload Form1
    lol...it's not VB6 dude , This keyword is no longer used in VB.NET

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