Load a form without blinking...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew Wells

    Load a form without blinking...

    I am trying to load a form (load Me) without the form becoming visible. If
    I try me.hide or me.visible = false, they load the form and the form blinks
    before becoming invisible. Is there a way to load the form without it
    becoming visible at all until I say me.visible = true?

    Thanks.

    Matthew Wells
    MWells@NumberCr uncher.com


  • Norman Yuan

    #2
    Re: Load a form without blinking...

    Load Me?

    I'd imagine this line of code is in the form's module, right?
    This code is only get to run when the form HAS BEEN loaded. So, why load
    itself again?

    To load form but to showing it, you do

    Dim myForm As TheForm

    'Load an instance of TheForm into memory
    'You can access the frm without showing it
    Set myForm=New TheForm
    myForm.Caption= "XXXXXXXXXXXXXX X"
    'Do other things
    'Show form
    myForm.Show 'You will see the form's caption is changed to
    "XXXXXXXXXXXXXX XXXX"

    "Matthew Wells" <MWells@NumberC runcher.com> wrote in message
    news:OE14c.7300 0$rB4.17268@big news6.bellsouth .net...[color=blue]
    > I am trying to load a form (load Me) without the form becoming visible.[/color]
    If[color=blue]
    > I try me.hide or me.visible = false, they load the form and the form[/color]
    blinks[color=blue]
    > before becoming invisible. Is there a way to load the form without it
    > becoming visible at all until I say me.visible = true?
    >
    > Thanks.
    >
    > Matthew Wells
    > MWells@NumberCr uncher.com
    >
    >[/color]


    Comment

    • Randy Birch

      #3
      Re: Load a form without blinking...

      Load Form1 will, perhaps not surprisingly, load form1. As the Load part
      indicates, it loads, not shows. Do you have a Refresh statement or an
      implicit Show statement somewhere in your code?

      You do *not* have to use the Dim f as TheForm as suggested in another
      response. Doing so in a non-MDI application is guaranteed to get you into
      trouble down the road.

      --

      Randy Birch
      MVP Visual Basic

      Please respond only to the newsgroups so all can benefit.


      "Matthew Wells" <MWells@NumberC runcher.com> wrote in message
      news:OE14c.7300 0$rB4.17268@big news6.bellsouth .net...
      : I am trying to load a form (load Me) without the form becoming visible.
      If
      : I try me.hide or me.visible = false, they load the form and the form
      blinks
      : before becoming invisible. Is there a way to load the form without it
      : becoming visible at all until I say me.visible = true?
      :
      : Thanks.
      :
      : Matthew Wells
      : MWells@NumberCr uncher.com
      :
      :


      Comment

      • Raoul Watson

        #4
        Re: Load a form without blinking...


        "Matthew Wells" <MWells@NumberC runcher.com> wrote in message
        news:OE14c.7300 0$rB4.17268@big news6.bellsouth .net...[color=blue]
        > I am trying to load a form (load Me) without the form becoming visible.[/color]
        If[color=blue]
        > I try me.hide or me.visible = false, they load the form and the form[/color]
        blinks[color=blue]
        > before becoming invisible. Is there a way to load the form without it
        > becoming visible at all until I say me.visible = true?
        >[/color]

        You obviously can't load the form from itself. In order to do that the form
        must have already been active (since your code is obviously executing) so
        that's probably the blink you saw.

        Instead of starting your code with a form, start your code in a module
        "Main" from there you can issue the Load form command.

        Do other things after the load command and when you're ready, just do
        form.show

        Just make sure that in the form load command, you don't have anything that
        triggers a refresh because the code in this section is executed when the
        form is loaded.




        Comment

        • Bob Butler

          #5
          Re: Load a form without blinking...

          "Raoul Watson" <WatsonR@Intell igenCIA.com> wrote in message news:<KP94c.87$ 3d.40@nwrdny03. gnilink.net>...[color=blue]
          > "Matthew Wells" <MWells@NumberC runcher.com> wrote in message
          > news:OE14c.7300 0$rB4.17268@big news6.bellsouth .net...[color=green]
          > > I am trying to load a form (load Me) without the form becoming visible.[/color]
          > If[color=green]
          > > I try me.hide or me.visible = false, they load the form and the form[/color]
          > blinks[color=green]
          > > before becoming invisible. Is there a way to load the form without it
          > > becoming visible at all until I say me.visible = true?
          > >[/color]
          >
          > You obviously can't load the form from itself. In order to do that the form
          > must have already been active (since your code is obviously executing) so
          > that's probably the blink you saw.[/color]

          You can load the form from itself; start a new project and add a BAS
          module and set the startup object to Sub Main and try this code:

          ' in the BAS module
          Private Sub Main()
          Dim f As Form1
          Set f = New Form1
          f.doit
          Unload f
          End Sub

          ' in the form
          Public Sub doit()
          Debug.Print "Doit start"
          Load Me
          Debug.Print "Doit Done"
          End Sub

          Private Sub Form_Initialize ()
          Debug.Print "Init"
          End Sub

          Private Sub Form_Load()
          Debug.Print "Load"
          End Sub

          Private Sub Form_QueryUnloa d(Cancel As Integer, UnloadMode As Integer)
          Debug.Print "QueryUnloa d"
          End Sub

          Private Sub Form_Terminate( )
          Debug.Print "Term"
          End Sub

          Private Sub Form_Unload(Can cel As Integer)
          Debug.Print "Unload"
          End Sub


          [color=blue]
          > Instead of starting your code with a form, start your code in a module
          > "Main" from there you can issue the Load form command.
          >
          > Do other things after the load command and when you're ready, just do
          > form.show
          >
          > Just make sure that in the form load command, you don't have anything that
          > triggers a refresh because the code in this section is executed when the
          > form is loaded.[/color]

          that is probably the problem... something in Form_Load is causing the
          form to be displayed.

          Comment

          • Matthew Wells

            #6
            Re: Load a form without blinking...

            Here's the exact problem. I want to position the controls BEFORE the form
            becomes visible. The form is resizable so I have code in the Form_Resize
            event. Loading the form by itself does not cause the blink, but after the
            code in Fomr_Load finished, it steps into Form_Resize and that's what causes
            the blink. I even have the form et to Visible=False in design view. I put
            the code in Form_Resize in a sub and tried calling the sub while the form
            was hidden - but when I do me.visible = true, the controls aren't moved.
            It's very ugly to have it visible. BTW, it's an MID child form.

            Any more ideas?


            "Matthew Wells" <MWells@NumberC runcher.com> wrote in message
            news:OE14c.7300 0$rB4.17268@big news6.bellsouth .net...[color=blue]
            > I am trying to load a form (load Me) without the form becoming visible.[/color]
            If[color=blue]
            > I try me.hide or me.visible = false, they load the form and the form[/color]
            blinks[color=blue]
            > before becoming invisible. Is there a way to load the form without it
            > becoming visible at all until I say me.visible = true?
            >
            > Thanks.
            >
            > Matthew Wells
            > MWells@NumberCr uncher.com
            >
            >[/color]


            Comment

            • Bob Butler

              #7
              Re: Load a form without blinking...

              "Matthew Wells" <MWells@NumberC runcher.com> wrote in message news:<O7o4c.389 $zP2.62@bignews 5.bellsouth.net >...
              <cu>[color=blue]
              > BTW, it's an MID child form.[/color]

              Check the 'AutoShowChildr en' property of the MDI parent

              Comment

              Working...