473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Waiting until loop finished.

Start learning VB 2005 EE and made a kind of Timing program.
Tried to show a text during time-call but it comes up only after the loop is
finished.
(TextBox2 in Sub Button1_Click)
I do not understand why.
Cannot find it either on internet.
Please can anyone explain to me the reason.
Here the code so far:
Public Class Form1

Dim Uitlezing As Single = 0

Dim Inlezing As Single = 0

Dim BeginTime As Double = 0

Dim FinishTime As Double = 0

Dim ElapsedTime As Single = 0

Dim Wachttijd As Single = 5

Dim Wachttext As String = ""

Dim TotalTime As Single = 0

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

TextBox2.Text = "Program Runs"

Call InitializeTimer(Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

TextBox1.Text = "Waiting Time was" & " " & Str(Inlezing) & " Seconds."

End Sub

Private Sub InitializeTimer(ByRef Uitlezing As Single, ByRef Wachttijd As
Single)

ElapsedTime = 0

BeginTime = Microsoft.VisualBasic.DateAndTime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.VisualBasic.DateAndTime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Wait.Click

Wachttext = MaskedTextBox1.Text

Wachttijd = Single.Parse(Wachttext)

Call InitializeTimer(Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Text = "Total Time is" & " " & Str(TotalTime) & " " & "Seconds"
End Sub
End Class

Many thanks,
Arie
Feb 5 '07 #1
3 4996
"A.G.van Staveren" <a.************@chello.nl>'s wild
thoughts were released on Mon, 5 Feb 2007 16:46:24 +0100
bearing the following fruit:
>Start learning VB 2005 EE and made a kind of Timing program.
This group is for VB6, you need a group with 'dotnet' in the
name.

J
>Tried to show a text during time-call but it comes up only after the loop is
finished.
(TextBox2 in Sub Button1_Click)
I do not understand why.
Cannot find it either on internet.
Please can anyone explain to me the reason.
Here the code so far:
Public Class Form1

Dim Uitlezing As Single = 0

Dim Inlezing As Single = 0

Dim BeginTime As Double = 0

Dim FinishTime As Double = 0

Dim ElapsedTime As Single = 0

Dim Wachttijd As Single = 5

Dim Wachttext As String = ""

Dim TotalTime As Single = 0

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

TextBox2.Text = "Program Runs"

Call InitializeTimer(Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

TextBox1.Text = "Waiting Time was" & " " & Str(Inlezing) & " Seconds."

End Sub

Private Sub InitializeTimer(ByRef Uitlezing As Single, ByRef Wachttijd As
Single)

ElapsedTime = 0

BeginTime = Microsoft.VisualBasic.DateAndTime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.VisualBasic.DateAndTime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Wait.Click

Wachttext = MaskedTextBox1.Text

Wachttijd = Single.Parse(Wachttext)

Call InitializeTimer(Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Text = "Total Time is" & " " & Str(TotalTime) & " " & "Seconds"
End Sub
End Class

Many thanks,
Arie

Jan Hyde (VB MVP)

--
So I went to the dentist. He said "Say Aaah." I said "Why?" He said "My dog's died."

Feb 5 '07 #2
Max
You would get the same result in VB6 any way

I can't see anything in the do loop that updates the text box.
"Jan Hyde" <St***********@REMOVE.ME.uboot.comwrote in message
news:8i********************************@4ax.com...
"A.G.van Staveren" <a.************@chello.nl>'s wild
thoughts were released on Mon, 5 Feb 2007 16:46:24 +0100
bearing the following fruit:
>>Start learning VB 2005 EE and made a kind of Timing program.

This group is for VB6, you need a group with 'dotnet' in the
name.

J
>>Tried to show a text during time-call but it comes up only after the loop
is
finished.
(TextBox2 in Sub Button1_Click)
I do not understand why.
Cannot find it either on internet.
Please can anyone explain to me the reason.
Here the code so far:
Public Class Form1

Dim Uitlezing As Single = 0

Dim Inlezing As Single = 0

Dim BeginTime As Double = 0

Dim FinishTime As Double = 0

Dim ElapsedTime As Single = 0

Dim Wachttijd As Single = 5

Dim Wachttext As String = ""

Dim TotalTime As Single = 0

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

TextBox2.Text = "Program Runs"

Call InitializeTimer(Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

TextBox1.Text = "Waiting Time was" & " " & Str(Inlezing) & " Seconds."

End Sub

Private Sub InitializeTimer(ByRef Uitlezing As Single, ByRef Wachttijd As
Single)

ElapsedTime = 0

BeginTime = Microsoft.VisualBasic.DateAndTime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.VisualBasic.DateAndTime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Wait.Click

Wachttext = MaskedTextBox1.Text

Wachttijd = Single.Parse(Wachttext)

Call InitializeTimer(Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Text = "Total Time is" & " " & Str(TotalTime) & " " & "Seconds"
End Sub
End Class

Many thanks,
Arie


Jan Hyde (VB MVP)

--
So I went to the dentist. He said "Say Aaah." I said "Why?" He said "My
dog's died."

Feb 6 '07 #3
"Max" <no****@spamcatchers.com>'s wild thoughts were
released on Tue, 6 Feb 2007 22:00:36 +1100 bearing the
following fruit:
>You would get the same result in VB6 any way
That's not necessarily true at all.

J
>I can't see anything in the do loop that updates the text box.
>"Jan Hyde" <St***********@REMOVE.ME.uboot.comwrote in message
news:8i********************************@4ax.com.. .
>"A.G.van Staveren" <a.************@chello.nl>'s wild
thoughts were released on Mon, 5 Feb 2007 16:46:24 +0100
bearing the following fruit:
>>>Start learning VB 2005 EE and made a kind of Timing program.

This group is for VB6, you need a group with 'dotnet' in the
name.

J
>>>Tried to show a text during time-call but it comes up only after the loop
is
finished.
(TextBox2 in Sub Button1_Click)
I do not understand why.
Cannot find it either on internet.
Please can anyone explain to me the reason.
Here the code so far:
Public Class Form1

Dim Uitlezing As Single = 0

Dim Inlezing As Single = 0

Dim BeginTime As Double = 0

Dim FinishTime As Double = 0

Dim ElapsedTime As Single = 0

Dim Wachttijd As Single = 5

Dim Wachttext As String = ""

Dim TotalTime As Single = 0

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

TextBox2.Text = "Program Runs"

Call InitializeTimer(Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

TextBox1.Text = "Waiting Time was" & " " & Str(Inlezing) & " Seconds."

End Sub

Private Sub InitializeTimer(ByRef Uitlezing As Single, ByRef Wachttijd As
Single)

ElapsedTime = 0

BeginTime = Microsoft.VisualBasic.DateAndTime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.VisualBasic.DateAndTime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Wait.Click

Wachttext = MaskedTextBox1.Text

Wachttijd = Single.Parse(Wachttext)

Call InitializeTimer(Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Text = "Total Time is" & " " & Str(TotalTime) & " " & "Seconds"
End Sub
End Class

Many thanks,
Arie


Jan Hyde (VB MVP)

--
So I went to the dentist. He said "Say Aaah." I said "Why?" He said "My
dog's died."

Jan Hyde (VB MVP)

--
"Eating Disorders" by Anna Rexia (Neil Enns)

Feb 6 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Eric | last post by:
Let me start off by saying I have VB working model which means no help. I have searched MSDN. It seems that I get "Read the help" instead of answers which is totally useless to me. With that...
4
by: .Net Sports | last post by:
I am trying to display records from a recordset after sql statement: <% sqlstr ="SELECT horsename FROM tblhorseentry WHERE trackname = '" & request.querystring("trackname") & "' and racedate =...
2
by: MLH | last post by:
Take a look at the code that follows. Line 110 is the beginning of Do-Loop. Regarding line #220, I find that I'm getting Error #3021 (No Current Record) during execution of line #230. It puzzles me...
0
by: ProJee | last post by:
Hi, Response.WriteFile (or Response.OutputStream.Write) finishes immediately, not after the file is completely downloaded. It finishes before (!) the user clicks the "Save" or "Open" browser...
15
by: shannon | last post by:
Hello, I am wondering if a Do until loop can be used in Javascript. I have an array and want to fill the array 10 times with the users details until it reaches 10 or if they press cancel. I'm...
1
by: stahl.karl | last post by:
I am trying to update an image when I load a page, then perform a bunch of other actions that take a while. The problem is that the image does not update until the entire function has finished...
4
by: Madhavi | last post by:
Hi Is there any Do Until Loop in C# Maadhavi
3
by: SyGC | last post by:
Hi People, Im trying to do a simple Loop where by an IP address is pinged (Using My.computer.network.ping) and the results, true or false, are used to invoke another line of code. Basically if...
5
by: dbrother | last post by:
Access 2003 Win XP Pro SP3 Using SQL /ADO Recordsets in a Do Loop Hello, I'm using a random number generator based on an integer input from a user from a form that will get X number of random...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.