473,386 Members | 1,766 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,386 software developers and data experts.

Form not refreshing

Good day.

I wrote an application to convert data from one database to another. It
runs through about 100,000 records for this conversion. That bit works
fine.

I have on the form a progress bar and a label to tell me how far it has
gotten and what record it is currently on, respectively.

The problem is that usually (but not always), as it is processing
records, the form stops refreshing and appears to hang. I am even told
by Task Manager that it is Not Responding. However, the hard drive is
churning, and if I leave it go for a while, it will eventually finish
processing.

This happens during debug as well. I can pause it in debug and see that
it is running (the counters continue incrementing). If I pause and step
through to just after my me.refresh (which happens at the end the
process of each record), it still doesn't actually refresh the form.

Thanks for any help.

Steve Hoyer
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
3 2393
Hi,

Place Application.DoEvents in your loop. It will allow the form to
update itself.
Ken
--------------
"Steve Hoyer" <st********@hotmail.com> wrote in message
news:#W**************@TK2MSFTNGP10.phx.gbl:
Good day.

I wrote an application to convert data from one database to another. It

runs through about 100,000 records for this conversion. That bit works
fine.

I have on the form a progress bar and a label to tell me how far it has
gotten and what record it is currently on, respectively.

The problem is that usually (but not always), as it is processing
records, the form stops refreshing and appears to hang. I am even told
by Task Manager that it is Not Responding. However, the hard drive is
churning, and if I leave it go for a while, it will eventually finish
processing.

This happens during debug as well. I can pause it in debug and see that

it is running (the counters continue incrementing). If I pause and step

through to just after my me.refresh (which happens at the end the
process of each record), it still doesn't actually refresh the form.

Thanks for any help.

Steve Hoyer
*** Sent via Devdex HYPERLINK "http://www.devdex.com"http://www.devdex.com
***
Don't just participate in USENET...get rewarded for it!


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #2
* Steve Hoyer <st********@hotmail.com> scripsit:
I wrote an application to convert data from one database to another. It
runs through about 100,000 records for this conversion. That bit works
fine.

I have on the form a progress bar and a label to tell me how far it has
gotten and what record it is currently on, respectively.


You could call 'Application.DoEvents' every n-th dataset you are
processing, or you could move the processing stuff into a separate
thread that updates the UI using invoke. A sample for thread-safe
updating an UI from another thread can be found here:

<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
I added the doevents so it runs every 100 records and it works great.
Thank you.

Steve Hoyer
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4

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

Similar topics

1
by: LRD | last post by:
Form not refreshing after autopostback unless keyboard or mouse move Hi, We created several new ASP.NET C# forms for our intranet. In each form we use panels for different sections of the...
0
by: Mark Payne | last post by:
Gudday, I have an Access 2000 database which I am using as a phone directory of residents in the hostel where I work. The front end for this directory is a form with a text box (the search name...
1
by: Robert Clark | last post by:
This a pocket pc/smartphone questions mainly, but i thought i'd ask the question in the C# newsgroup. I have a form which i use to display information from a web service. From this form i open...
3
by: User | last post by:
Form A (Main) Text Box 1 Text Box 2 Text Box 3 Form B (Pop-up) Choose a selection for Form A/Text Box 3 Scenario:
2
by: dmartin_1 | last post by:
I'm building an application with Visual Basic 2005. The application is multi threaded. It has a record counter on the form that counts up to completion. It works fine throughout the process as...
2
by: AJang | last post by:
My windows form "Form1" has one Button "button1" and one TextBox "textBox1". When I click button1, it do a job for each file in a directory. The job include some platform invoke call. Before...
1
by: bgreenspan | last post by:
Hi Everyone, I'm back for some more expert help. Here's what I am doing and what I tried. My database has entries with Contract Names and Expiry Dates, among other fields. I have a form...
1
by: suhaniya | last post by:
hi friends, I am trying to add a form and its coding at runtime.I have done it succesfully but the problem is i want to access that newly created coding after creation of the form.I tryed by...
1
by: Kirthikaiitm | last post by:
Hi, I have a image button (APPLY) On clicking apply button how to move the content from textbox to another textarea. I wrote the code in JScript. But once i click APPLY button the form is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.