Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2007

Tip: Looking for answers? Try searching our database.

How to display a record counter on a form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Girgenti - 18 Mar 2007 15:54 GMT
Hello.

Developing VS2005, SP1, .NET 2.0, VB Windows form program on WIN XP Pro,
SP2.

The program reads a large amount of records from a flatfile.  While it is
doing that i tried  to display a record counter in a label control.  The
only way i could think of to do this is to use the following code:

recordsReadCounter +=1
Me.recordsReadLabel.Text = recordsReadCounter.ToString
Me.Refresh()

The problem is that sometimes it displays the counter as it changes for a
while, but then it just stops displaying and sits with an hour glass until
it finishes and finally displays the total count.  If i minimize the window
and go back to it, the counter is not moving and again it sits there with an
hour glass until it finishes.

It seems to stop displaying the counter at different counts, sometimes at a
low count and at other times a high count, but it always displays the
correct count when it finishes.

Is there a way to display a record count where it displays continuously
until it is finished?

I'm not looking for a progress bar.  I just want to display the record count
after each record is read.

Any help would be gratefully appreciated.

Thanks,
Tony
VJ - 18 Mar 2007 16:05 GMT
Looks like the display Control is not painting as needed. Real quick fix is
to do this

Label1.Text = "Counter" + i.ToString();
Application.DoEvents(); //refresh and repaint.!

Not desirable, but will tell you if it works and runs as expected or if
there are other issues. What we have done is to put up a splash screen when
executing such process and then keep updating the splash screen. The code
that executs the process runs in a separate thread, the UI or Application
thread displays splash screen and keeps updating messages. What this does is
does not lock the UI refresh when updating , which happens in your case.

If you need help in using threads, please ask
VJ

> Hello.
>
[quoted text clipped - 29 lines]
> Thanks,
> Tony

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.