Question

Locked

Time Loop

By a.vanstaveren1 ·
Cannot understand why first TextBox instruction in next code does not work.

Public Class Form1
Dim Value As Double
Dim Begin As Double
Dim Eind As Double
Dim Verstreken As Double
Dim Duur As Double = 5.45


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

TextBox1.Text = "Program runs"

Begin = DateAndTime.Timer

Do While Verstreken <= Duur


Eind = DateAndTime.Timer
Verstreken = Eind - Begin
Loop

TextBox1.Text = Str(Verstreken)

End Sub


End Class

Can anyone give me an explanation pls.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

If you mean you are n't seeing

by Tony Hopkinson In reply to Time Loop

Program Runs

TextBox1.Text = "Program runs"
DoEvents
....

That will process any outstanding windows mesages which includes the request to redraw
the edit box. Your process is so busy in the loop there's no time to process the queue.

Note if you expect to do things UI wise within the loop (e.g click an cancel button) then you need to put DoEvents inside the loop, to get a response from the window(s).

Collapse -

Unvisible Text

by a.vanstaveren1 In reply to If you mean you are n't s ...

The DoEvents just worked fine.
Many thanks Tony.
Greetings,
Arie

Back to Windows Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums