Results 1 to 6 of 6

Thread: How to Use Load method?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Indiana,PA,USA
    Posts
    217

    Question How to Use Load method?

    Hi,

    I am trying toload a form like this,But getting error.I want to load form and kept in memory.Any one know this how to do?

    Load Form1 ? 'Getting error

    Thanks.
    Sudha

  2. #2
    Addicted Member Gavin_Mannion's Avatar
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    214
    If I understand what you mean try.

    form1.show vbmodal, me

    this will 'load' a form.
    Gavin Mannion

    Jackofalltrades.

    "Some people are alive simply because it is against the law to kill them." - Anonymous

    //TODO: Insert smart comment here

  3. #3
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    If, when you do

    Load Form1

    you get an error then you should look at the form's Load event to see what code is being executed.
    If you still can't see the error in the code, then set a breakpoint (F9) on the "Load Form1" line, and run the program.
    When the program stops at the breakpoint use 'stepping' (F8) to step through each line of the load event until the error appears. That should help.

    Form1.Show will load the form before showing it, so you should get the same error if you do this.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Indiana,PA,USA
    Posts
    217
    I am explaining my requirement again.

    I have two forms Form1 and Form2.

    In Form1 load event I said Load form2.My thinking is when I run this program it has to show form1 and load Form2 but don't show me keep it in memory.


    Now can you tell me can I do this?
    Sudha

  5. #5
    Addicted Member Gavin_Mannion's Avatar
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    214
    I have no idea why you would want to do this but try this.

    in form1 onload event
    VB Code:
    1. form2.show vbmodal, form1

    in form2 onload event
    VB Code:
    1. form2.hide

    would that work?
    Gavin Mannion

    Jackofalltrades.

    "Some people are alive simply because it is against the law to kill them." - Anonymous

    //TODO: Insert smart comment here

  6. #6
    Frenzied Member jjortiz's Avatar
    Join Date
    Mar 2001
    Location
    NYC
    Posts
    1,768
    Ok the load function loads objects into memory. So if you use the following syntax ( load form1) then the form will be loaded into memory and not displayed. I just tried it in my IDE(VB) and it works fine. There must be other problems with your first form. Try opening a new project and then create a second form and place a button on the first form.
    In the load event of the first form place the following code
    load form1 then in the click event for the button place the following code form1.show. If this all works fine then there is another problem and i would suggest using break on all errors in the options window. or use F9 to step through it.

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