By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

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

P: 12
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
Jul 2 '08 #1
Share this Question
Share on Google+
5 Replies


debasisdas
Expert 5K+
P: 8,127
what do you want this code textBox.refresh() to do ?

what is the use of refreshing a textbox inside a loop ?
Jul 3 '08 #2

P: 12
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
Jul 3 '08 #3

QVeen72
Expert 100+
P: 1,445
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
Jul 3 '08 #4

P: 12
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
Jul 3 '08 #5

QVeen72
Expert 100+
P: 1,445
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
Jul 25 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.