473,394 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
Jun 1 '06 #1
6 7175
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.BeginInvoke to marshall the call to
the UI thread.
Jun 1 '06 #2
Mehdi <vi****@REMOVEME.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:he***************************@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.BeginInvoke to marshall
the call to the UI thread.


Jun 1 '06 #3
try putting

Application.DoEvents()

within the loop

-tom

Chris Moore ha scritto:
Mehdi <vi****@REMOVEME.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:he***************************@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.BeginInvoke to marshall
the call to the UI thread.


Jun 1 '06 #4
ods
That appears to have corrected it.

Thanks.
to**************@uniroma1.it wrote in
news:11**********************@y43g2000cwc.googlegr oups.com:
try putting

Application.DoEvents()

within the loop

-tom

Chris Moore ha scritto:
Mehdi <vi****@REMOVEME.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:he***************************@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.BeginInvoke to marshall the call to the UI thread.
>



Jun 1 '06 #5
good.
Applications are like humans, sometimes they need to breath :)

-tom

ods ha scritto:
That appears to have corrected it.

Thanks.
to**************@uniroma1.it wrote in
news:11**********************@y43g2000cwc.googlegr oups.com:
try putting

Application.DoEvents()

within the loop

-tom

Chris Moore ha scritto:
Mehdi <vi****@REMOVEME.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:he***************************@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.BeginInvoke to marshall the call to the UI thread.
>



Jun 4 '06 #6
OC
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

Jun 27 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Craig C | last post by:
I have a Simple Windows Form which I placed a button and when the button is pressed it proceses data into a database and I update the task bar for each record. The task bar would show processing 1...
5
by: Morten Wennevik | last post by:
I'm pretty sure this has been mentioned a few times, but so far I haven't found anything. I am trying to "lock" a program to always focus, non closable etc, but overriding OnDeactivate and...
1
by: DomGo | last post by:
Hi, I try to open a form, that automatically loses focus to the window, that had the focus immediatly before the new form has been opened. The new form is topmost and displays a message only for...
0
by: Stefan De Schepper | last post by:
Dear NG, I created a gridlike usercontrol. When clicking on a cell a textbox (or other control, depending on the cell's editortype) is shown. When some other control gets the focus, the textbox...
3
by: Chris | last post by:
I have a form that calls ShowDialog on a number of different forms at different times. I want to be able to know anytime the form loses focus. But Form.Focused isn't ever true once a control has...
3
by: edamron | last post by:
I am writing my first VB.Net program and have come across an interesting problem. My department generates large volumes of documents. By law we are required to keep the documents for a specific...
1
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP...
5
by: LabGeek | last post by:
I have an Access application that I have created that collects data from a scanner and from a weighting scale. The data from the scanner are unique identifiers (barcodes) and the scanner is...
25
bugboy
by: bugboy | last post by:
I'm trying to find a cross browser solution for editing text in a flickr photo caption manor where the text is displayed in a <div> or <a> tag but changes to a <textarea> via JS when clicked. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.