Results 1 to 13 of 13

Thread: How to load a form without showing it?

Hybrid View

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    How to load a form without showing it?

    i already tryed

    VB Code:
    1. Frm.Show
    2. Frm.Visible = False

    and it shows the form in half a sec and then hides it...

    already tryed too:

    VB Code:
    1. Frm.Visible = False
    2. Frm.Show

    didnt work too...

    in VB6 i could use the load(frm) but now it requires a second argument, and i dont know what is it...any help or ideas?

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Do it in the constructor or set design time visible property to false.

  3. #3
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261
    Dim frm as New Form1

    Just like with any other object, this will cause a new instance of Form1 to be loaded.

  4. #4

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    it is PUBLIC...

  5. #5

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    ......

  6. #6
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261
    Originally posted by PT Exorcist
    it is PUBLIC...

    ????
    So what? You can create new instances of public classes with the way I've mentioned.

  7. #7
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    I've tried to load a from without showing it.... didnt work
    You could set the opacity to zero at design time so it wouldnt show, but it's not the best way to do this I guess...


    The form always shows up for a second even if you try to hide it when you are loading it.... pretty weird

  8. #8
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    What is wrong with this:
    Dim frmTemp As Form1
    Set frmTemp = New Form1()

    It loads an instance of the form, but doesn't show it...
    Maybe I am not understanding the problem though...

  9. #9
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by hellswraith
    What is wrong with this:
    Dim frmTemp As Form1
    Set frmTemp = New Form1()

    It loads an instance of the form, but doesn't show it...
    Maybe I am not understanding the problem though...
    I guess it works
    Umm there is only one thing that I dont understand... when you do this Form_Load event wont fire. It doesnt make sense

  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Whatever you want to fire can just go in the New() method instead of in the Form_Load.

  11. #11
    New Member
    Join Date
    Jul 2002
    Location
    Mesa,AZ
    Posts
    4

    Smile Load frmMyForm

    In VB 6 it is ...
    Load frmMyForm

    Is the Unload and Load commands gone in VB.NET?
    Bar Jabba

  12. #12
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Umm you dont load a class with a load statement, so I guess it's useless becuase most of the stuff are treated as classes

  13. #13
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    No instead of Load you use the objects constructor which is some form of New() method. The Form_Load event only fires when the form is becoming visible (as far as I can tell) kind of like a one time Activated event. But any code in the constructor called to make the object runs when it is called.
    VB Code:
    1. 'in the class
    2. Public Sub New()
    3.   MyBase.New()
    4.   Msgbox ("Shhh I'm loading")
    5. End Sub
    6.  
    7. 'Or if it is a form we are talking about
    8. Public Sub New()'is in the region at the top
    9.     'just skip past all the creation of the controls and that jazz
    10.     Msgbox ("Shh I'm loading and a Form")
    11. End SUb
    12.  
    13. 'in app
    14. dim obj as New Object1 'will fire the msgbox here

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