Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

TextBox Update inside of a loop (.Net 1.1) / VS 2003

Question posted by: ssouhrada (Newbie) on July 2nd, 2008 07:16 PM
Hello,

I have a simple loop that adds values to a textbox. I would like to have it refresh the text box every 100 records so that the end user still believes it is processing data (it sometimes crunches several thousand records). I don't have the .refresh method for a textbox in .Net 1.1. How was this accomplished prior to 2.0? Below is an example of the behavior simiar to what I want.

Thanks in advance


for i = 0 to 1000

textBox.Text = i
textBox.refresh()
System.Threading.Thread.Sleep(200)

Next
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
debasisdas's Avatar
debasisdas
Moderator
6,450 Posts
July 3rd, 2008
06:38 AM
#2

Re: TextBox Update inside of a loop (.Net 1.1) / VS 2003
what do you want this code textBox.refresh() to do ?

what is the use of refreshing a textbox inside a loop ?

Reply
ssouhrada's Avatar
ssouhrada
Newbie
7 Posts
July 3rd, 2008
12:08 PM
#3

Re: TextBox Update inside of a loop (.Net 1.1) / VS 2003
I have some code that processes some numbers (several thousand at a time). I would like to update the end user of the progress so they don't wait for 5+ minutes while it assembles this list. Basically my code takes input from one list and then sorts it and puts it in one of 3 lists classifying if they are valid, invalid, incomplete. Within this loop I would like the code to update the text box so the user can visually see that the code is working rather than waiting several minutes for the code to complete.

Does that make sense? The big question is.... I don't have access to the .refresh method for a textbox. I'm using Dot Net 1.1 with VS 2003. I'm wondering if they offered the ability to do something similar with older code.


Thanks

Reply
QVeen72's Avatar
QVeen72
Expert
1,246 Posts
July 3rd, 2008
05:10 PM
#4

Re: TextBox Update inside of a loop (.Net 1.1) / VS 2003
Hi,

When it is being continously changing, add "DoEvents"


for i = 0 to 1000
textBox.Text = i
DoEvents
System.Threading.Thread.Sleep(200)
Next

I guess, if you are wanting to Display, the Position/Record Count in a loop like that, "StatusBar" is the best control. It auto refreshes itself, and dosent flicker or gets blurred..

Regards
Veena

Reply
ssouhrada's Avatar
ssouhrada
Newbie
7 Posts
July 3rd, 2008
06:28 PM
#5

Re: TextBox Update inside of a loop (.Net 1.1) / VS 2003
In my version of DotNet (1.1) I don't have a statusbar control. I also don't have the DoEvents Method to call in the function. I may need to directly reference it similar to the sleep function. Do you know the full path of DoEvents or the statusbar?

Example (System.Threading.Thread.Sleep)

Thanks

Reply
QVeen72's Avatar
QVeen72
Expert
1,246 Posts
July 25th, 2008
07:22 AM
#6

Re: TextBox Update inside of a loop (.Net 1.1) / VS 2003
Hi,

Sorry for replying so late..

in VB.net it is :
Application.DoEvents

and StatusBar is called as StatusStrip in VB.net. It is available in General ToolBox under "Menu and ToolBars"

Regards
Veena

Reply
Reply
Not the answer you were looking for? Post your question . . .
184,042 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top Visual Basic Forum Contributors