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 / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

displaying data realtime in a textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
auldh - 12 Mar 2008 21:08 GMT
hello,
i'm not sure if this is possible. i have a small VS 2005 C# windows
application. it has a textbox and a button. once the user presses the button
it fires off many tasks. i want to use the "textbox" to give realtime update,
a status window.

it seems that in some part of the program the window form goes blank and
there is no status. however once the program stops i get my textbox/status
updates.

so the question is, can i get the textbox to give realtime update? i tried
the textbox.refresh() and nothing. i get no status/updates until the program
stops running.
Paul E Collins - 12 Mar 2008 21:19 GMT
> i want to use the "textbox" to give realtime update
> [...]
> it seems that in some part of the program the window form goes blank
> and there is no status.

If you do long-running tasks on the main (GUI) thread, the window can't
update properly. Use the BackgroundWorker control, or create a separate
thread to do the long-running task.

Eq.
auldh - 12 Mar 2008 23:35 GMT
thanks Paul, i will research this.

> > i want to use the "textbox" to give realtime update
> > [...]
[quoted text clipped - 6 lines]
>
> Eq.
JamesB - 13 Mar 2008 09:23 GMT
>> i want to use the "textbox" to give realtime update
>> [...]
[quoted text clipped - 4 lines]
> update properly. Use the BackgroundWorker control, or create a separate
> thread to do the long-running task.

Auldh has the better answer, but for something quick and dirty, you might
want to put some "Application.DoEvents()" in at various points (i.e. where
you put in the Refresh()) - this will enable the UI to update.
Peter Duniho - 13 Mar 2008 18:20 GMT
> Auldh has the better answer, but for something quick and dirty, you  
> might want to put some "Application.DoEvents()" in at various points  
> (i.e. where you put in the Refresh()) - this will enable the UI to  
> update.

Please do not recommend Application.DoEvents() when there are other,  
superior alternatives available.  It's not something to be used in a  
well-written program and is not appropriate as a recommendation.

If you observe a situation where the _only_ way to solve the problem is  
calling DoEvents(), by all means suggest it.  Otherwise, you're only  
encouraging sloppy programming practices and that's not something that any  
responsible person should want to do.

Pete

Rate this thread:







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.