Progress Bar Window Not Drawing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bennett.sean@gmail.com

    #1

    Progress Bar Window Not Drawing

    Hi,

    I've tried a number of different things including the use of threads
    and timers, but can't come up with the solution yet.

    The issue is this: launch a window with an animation or progress bar
    that changes. While this "progress window" is being animated, launch
    the actual window. Finally close the "progress window".

    The problem is, the "progress window" does not render the gui until the
    second window is done loading.

    Any links or hints are appreciated.

    Thanks,

    Sean.

  • TrtnJohn

    #2
    RE: Progress Bar Window Not Drawing

    You need to add some Application.DoE vents calls into your load code for the
    second window. All of this processing is occuring on a single thread of
    execution. The timer events will not be received by the progress bar window
    unless periodically you give up execution by calling Application.DoE vents.
    Otherwise the only code that gets a chance to run is the code that is loading
    your form.

    "bennett.sean@g mail.com" wrote:
    [color=blue]
    > Hi,
    >
    > I've tried a number of different things including the use of threads
    > and timers, but can't come up with the solution yet.
    >
    > The issue is this: launch a window with an animation or progress bar
    > that changes. While this "progress window" is being animated, launch
    > the actual window. Finally close the "progress window".
    >
    > The problem is, the "progress window" does not render the gui until the
    > second window is done loading.
    >
    > Any links or hints are appreciated.
    >
    > Thanks,
    >
    > Sean.
    >
    >[/color]

    Comment

    • bennett.sean@gmail.com

      #3
      Re: Progress Bar Window Not Drawing

      DoEvents does do the trick... but the problem is that the code blocking
      the message queue is in the InitializeCompo nent Sub of a form... so I
      can't exactly put Application.DoE vents every 10 lines in
      InitializeCompo nent.

      There must be an easy solution. Help anyone?

      Thanks,

      Sean

      Comment

      • bennett.sean@gmail.com

        #4
        Re: Progress Bar Window Not Drawing

        I found out what was wrong.

        Creating a thread was the right way to go but some additional
        properties of that thread had to be set.

        This is what made it work:

        Dim t As System.Threadin g.Thread
        t = New System.Threadin g.Thread(Addres sOf progressThreadS tart)
        t.IsBackground = True
        t.ApartmentStat e = Threading.Apart mentState.STA
        t.Start()

        the IsBackground and ApartmentState lines did the trick.

        Comment

        Working...