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 / July 2006

Tip: Looking for answers? Try searching our database.

Update Text from thread

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joelcochran@gmail.com - 19 Jul 2006 16:30 GMT
I have a form with a text box (and I have tried this with labels,
listboxes, etc.) that I want to update from a thread.  The thread is a
class that loops (say a thousand times) and randomly selects a string
from an array.  Each time it selects another string, I want the
selected string to be shown on the calling form.  The affect should be
that the text appears to be constantly changing until the final
selection is made.

The problem I'm having is that the text remains blank until the process
is complete.  I have done this sort of thing (updating lists and
progress bars) before, but I can't figure out why this text won't
update.  In fact, there is also a progress bar being updated at the
same time which is working perfectly.

I also tried invalidating the control, but that had no effect.  In
debug, I have confirmed that the delegate method is receiving the
string, and the control Text property is being updated, so the
Threading is working correctly, it is just not showing the change on
the screen.

Any ideas?

Thanks,

Joel
joelcochran@gmail.com - 19 Jul 2006 16:53 GMT
I guess I posted too quickly... I figured it out a few minutes later...

The problem is that the thread is operating too quickly, so it's like
the calling form does not have time to redraw.  I added a
Thread.Sleep(10) to my loop, and now it works exactly as I wanted...

Thanks,

Joel

> I have a form with a text box (and I have tried this with labels,
> listboxes, etc.) that I want to update from a thread.  The thread is a
[quoted text clipped - 21 lines]
>
> Joel

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.