Link to home
Start Free TrialLog in
Avatar of rswickersham
rswickersham

asked on

NO TEXT IN TEXT BOX

I was wondering if any one know why when I turn on the text in a message box before
I go into a loop that processed data or does other things the text does not display.  The box will
display but when I put up a message like a count of were I am or some information of what is going on the box is blank.  If I pause in a debug mode the text will display and be there if I continue.
I suppose if I put a big delay in it might show up before I started processing but I am not sure why its not displaying  - Any one experienced this??

ASKER CERTIFIED SOLUTION
Avatar of Farzad Akbarnejad
Farzad Akbarnejad
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
FarzadA said it right. basically what happens is that VB is doing the processing the screen painting /refreshing being at lower priority is ignored. when you give doevents it gives the system some time to carry out events like painting the screen or refresshing. remember though each call reduces the speed of ur program.
Bhagyesh Trivedi
Avatar of mmusante
mmusante

You can also call the refresh method of your textbox
Check that Option Explicit is on.

If you are setting the text into one variable and displaying another due to a mistyping of the variable name then it will display nothing.
mmusante is right.

Use the refresh method.

By the way if you have a need for speed use a label instead of a textbox.
It is a little faster in repainting. And if you use it in a tight loop. refresh it just once in a while.

As a sidenote
DoEvents can be very dangerous. Use it with care.
With a doEvents your program flow can be different than you expect.
Try using it in a dataarrival event from a winsock and you'll see what i mean.
Another bad habit of doEvents when used often is it will push up your CPU usage in the taskmanager to a 100%. That can give a false impresion about the real cpu usage of your program.

When you need a little pause in your programm or give some cpu time to another process use Sleep()

And SRigney is SO right.
A lot of mistakes even typos can be detected while compiling. A make exe once in a while is a good practice if your program gets a bit bigger. Just running it from VS will not do a full compile.






You can do a start with full compile ctrl+f5 and it will verify everything is correct as it does with an actual compile.