VB.NET Screen Stops Refreshing After Losing Focus??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Moore

    #1

    VB.NET Screen Stops Refreshing After Losing Focus??

    I have a .NET form where I am updating a progress bar & counter. As long
    as the form never loses focus, everything on the form refreshs fine. But If
    I open another window (like Windows Explorer) and then re-select my .net
    form, thos fields no longer refresh. Why and ho wdo I make it start
    refreshing again?

    Thanks
  • Mehdi

    #2
    Re: VB.NET Screen Stops Refreshing After Losing Focus??

    On Thu, 01 Jun 2006 13:29:45 -0700, Chris Moore wrote:
    [color=blue]
    > I have a .NET form where I am updating a progress bar & counter. As long
    > as the form never loses focus, everything on the form refreshs fine. But If
    > I open another window (like Windows Explorer) and then re-select my .net
    > form, thos fields no longer refresh. Why and ho wdo I make it start
    > refreshing again?[/color]

    It sounds like you're accessing some of your UI controls from a worker
    thread (the progress bar and the counter probably). UI controls must be
    accessed from the UI thread only. If you have to access them from a worker
    thread, use Control.Invoke or Control.BeginIn voke to marshall the call to
    the UI thread.

    Comment

    • Chris Moore

      #3
      Re: VB.NET Screen Stops Refreshing After Losing Focus??

      Mehdi <vioccc@REMOVEM E.gmail.com> wrote in
      I have no idea what you just said, sorry. What I have is 1 form with a
      button, progress bar & label on it. When I run it, I press the button
      that then calls a procedure (that is in the form) to process some records
      and update the controls.

      What am I missing or not understanding?

      Thanks

      news:heawgmahab xx.zuvwiijdairp .dlg@40tude.net :
      [color=blue]
      > On Thu, 01 Jun 2006 13:29:45 -0700, Chris Moore wrote:
      >[color=green]
      >> I have a .NET form where I am updating a progress bar & counter. As
      >> long as the form never loses focus, everything on the form refreshs
      >> fine. But If I open another window (like Windows Explorer) and then
      >> re-select my .net form, thos fields no longer refresh. Why and ho
      >> wdo I make it start refreshing again?[/color]
      >
      > It sounds like you're accessing some of your UI controls from a worker
      > thread (the progress bar and the counter probably). UI controls must
      > be accessed from the UI thread only. If you have to access them from a
      > worker thread, use Control.Invoke or Control.BeginIn voke to marshall
      > the call to the UI thread.
      >[/color]

      Comment

      • tommaso.gastaldi@uniroma1.it

        #4
        Re: VB.NET Screen Stops Refreshing After Losing Focus??

        try putting

        Application.DoE vents()

        within the loop

        -tom

        Chris Moore ha scritto:
        [color=blue]
        > Mehdi <vioccc@REMOVEM E.gmail.com> wrote in
        > I have no idea what you just said, sorry. What I have is 1 form with a
        > button, progress bar & label on it. When I run it, I press the button
        > that then calls a procedure (that is in the form) to process some records
        > and update the controls.
        >
        > What am I missing or not understanding?
        >
        > Thanks
        >
        > news:heawgmahab xx.zuvwiijdairp .dlg@40tude.net :
        >[color=green]
        > > On Thu, 01 Jun 2006 13:29:45 -0700, Chris Moore wrote:
        > >[color=darkred]
        > >> I have a .NET form where I am updating a progress bar & counter. As
        > >> long as the form never loses focus, everything on the form refreshs
        > >> fine. But If I open another window (like Windows Explorer) and then
        > >> re-select my .net form, thos fields no longer refresh. Why and ho
        > >> wdo I make it start refreshing again?[/color]
        > >
        > > It sounds like you're accessing some of your UI controls from a worker
        > > thread (the progress bar and the counter probably). UI controls must
        > > be accessed from the UI thread only. If you have to access them from a
        > > worker thread, use Control.Invoke or Control.BeginIn voke to marshall
        > > the call to the UI thread.
        > >[/color][/color]

        Comment

        • ods

          #5
          Re: VB.NET Screen Stops Refreshing After Losing Focus??

          That appears to have corrected it.

          Thanks.


          tommaso.gastald i@uniroma1.it wrote in
          news:1149198501 .107577.129780@ y43g2000cwc.goo glegroups.com:
          [color=blue]
          > try putting
          >
          > Application.DoE vents()
          >
          > within the loop
          >
          > -tom
          >
          > Chris Moore ha scritto:
          >[color=green]
          >> Mehdi <vioccc@REMOVEM E.gmail.com> wrote in
          >> I have no idea what you just said, sorry. What I have is 1 form with
          >> a button, progress bar & label on it. When I run it, I press the
          >> button that then calls a procedure (that is in the form) to process
          >> some records and update the controls.
          >>
          >> What am I missing or not understanding?
          >>
          >> Thanks
          >>
          >> news:heawgmahab xx.zuvwiijdairp .dlg@40tude.net :
          >>[color=darkred]
          >> > On Thu, 01 Jun 2006 13:29:45 -0700, Chris Moore wrote:
          >> >
          >> >> I have a .NET form where I am updating a progress bar & counter.
          >> >> As long as the form never loses focus, everything on the form
          >> >> refreshs fine. But If I open another window (like Windows
          >> >> Explorer) and then re-select my .net form, thos fields no longer
          >> >> refresh. Why and ho wdo I make it start refreshing again?
          >> >
          >> > It sounds like you're accessing some of your UI controls from a
          >> > worker thread (the progress bar and the counter probably). UI
          >> > controls must be accessed from the UI thread only. If you have to
          >> > access them from a worker thread, use Control.Invoke or
          >> > Control.BeginIn voke to marshall the call to the UI thread.
          >> >[/color][/color]
          >
          >[/color]

          Comment

          • tommaso.gastaldi@uniroma1.it

            #6
            Re: VB.NET Screen Stops Refreshing After Losing Focus??

            good.
            Applications are like humans, sometimes they need to breath :)

            -tom

            ods ha scritto:
            [color=blue]
            > That appears to have corrected it.
            >
            > Thanks.
            >
            >
            > tommaso.gastald i@uniroma1.it wrote in
            > news:1149198501 .107577.129780@ y43g2000cwc.goo glegroups.com:
            >[color=green]
            > > try putting
            > >
            > > Application.DoE vents()
            > >
            > > within the loop
            > >
            > > -tom
            > >
            > > Chris Moore ha scritto:
            > >[color=darkred]
            > >> Mehdi <vioccc@REMOVEM E.gmail.com> wrote in
            > >> I have no idea what you just said, sorry. What I have is 1 form with
            > >> a button, progress bar & label on it. When I run it, I press the
            > >> button that then calls a procedure (that is in the form) to process
            > >> some records and update the controls.
            > >>
            > >> What am I missing or not understanding?
            > >>
            > >> Thanks
            > >>
            > >> news:heawgmahab xx.zuvwiijdairp .dlg@40tude.net :
            > >>
            > >> > On Thu, 01 Jun 2006 13:29:45 -0700, Chris Moore wrote:
            > >> >
            > >> >> I have a .NET form where I am updating a progress bar & counter.
            > >> >> As long as the form never loses focus, everything on the form
            > >> >> refreshs fine. But If I open another window (like Windows
            > >> >> Explorer) and then re-select my .net form, thos fields no longer
            > >> >> refresh. Why and ho wdo I make it start refreshing again?
            > >> >
            > >> > It sounds like you're accessing some of your UI controls from a
            > >> > worker thread (the progress bar and the counter probably). UI
            > >> > controls must be accessed from the UI thread only. If you have to
            > >> > access them from a worker thread, use Control.Invoke or
            > >> > Control.BeginIn voke to marshall the call to the UI thread.
            > >> >[/color]
            > >
            > >[/color][/color]

            Comment

            • OC

              #7
              Re: VB.NET Screen Stops Refreshing After Losing Focus??

              Good grief! I've Googled high and low for this answer. I

              've been developing Web apps for so long I'd forgotten how to do this.
              I know this is not the way I used to do it but this is far easier.
              Thank you so much!

              -Olice

              Comment

              Working...