473,753 Members | 7,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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.Visua lBasic.DateAndT ime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.Visua lBasic.DateAndT ime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles Wait.Click

Wachttext = MaskedTextBox1. Text

Wachttijd = Single.Parse(Wa chttext)

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 5019
"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(B yVal sender As System.Object, ByVal e As
System.EventAr gs) Handles Button1.Click

TextBox2.Tex t = "Program Runs"

Call InitializeTimer (Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

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

End Sub

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

ElapsedTime = 0

BeginTime = Microsoft.Visua lBasic.DateAndT ime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.Visua lBasic.DateAndT ime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVa l sender As System.Object, ByVal e As
System.EventAr gs) Handles Wait.Click

Wachttext = MaskedTextBox1. Text

Wachttijd = Single.Parse(Wa chttext)

Call InitializeTimer (Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Tex t = "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.c om...
"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(B yVal sender As System.Object, ByVal e As
System.EventA rgs) Handles Button1.Click

TextBox2.Te xt = "Program Runs"

Call InitializeTimer (Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

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

End Sub

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

ElapsedTime = 0

BeginTime = Microsoft.Visua lBasic.DateAndT ime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.Visua lBasic.DateAndT ime.Timer

ElapsedTime = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVa l sender As System.Object, ByVal e As
System.EventA rgs) Handles Wait.Click

Wachttext = MaskedTextBox1. Text

Wachttijd = Single.Parse(Wa chttext)

Call InitializeTimer (Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Te xt = "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****@spamcat chers.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(B yVal sender As System.Object, ByVal e As
System.Event Args) Handles Button1.Click

TextBox2.Tex t = "Program Runs"

Call InitializeTimer (Uitlezing, Wachttijd)

Inlezing = Uitlezing

Uitlezing = 0

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

End Sub

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

ElapsedTim e = 0

BeginTime = Microsoft.Visua lBasic.DateAndT ime.Timer

Do While ElapsedTime < Wachttijd

FinishTime = Microsoft.Visua lBasic.DateAndT ime.Timer

ElapsedTim e = (FinishTime - BeginTime)

Loop

Uitlezing = ElapsedTime

End Sub

Private Sub Wait_Click(ByVa l sender As System.Object, ByVal e As
System.Event Args) Handles Wait.Click

Wachttext = MaskedTextBox1. Text

Wachttijd = Single.Parse(Wa chttext)

Call InitializeTimer (Uitlezing, Wachttijd)

TotalTime = Inlezing + Uitlezing

TextBox2.Tex t = "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
15680
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 said can someone please help me understand why this does not work? Dim x As String Private Sub cmdlogin_Click() Do Until x = "Corey" If txtlogin = "Corey" Then
4
5834
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 = '" & request.querystring("racedate");" Set rs1 = Server.CreateObject("ADODB.Recordset") rs1.Open sqlstr,pConn,3
2
1791
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 as to Why? I thought if I was on last valid record of RecSet when line #220 executes, I would be sent to process lines after line #400. Am I wrong about that? ==> BEGIN CODE SNIPPET <=== 110 Do Until RecSet.EOF StartAnew:
0
2033
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 button, file size doesn't matter. I'm not possible to track if the file was completely downloaded or if the user only clicked the link and cancelled the download. I've created a simple "solution" of this problem, which waits until the
15
51853
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 using window.prompt to get user info. Any suggestions. Do { //ask user to input their details } while (myairline !=10);
1
1492
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 running. Is there some command that will allow me to force the first line to run, THEN do the rest of the other stuff in the function? Here's an example of what I am trying to do: <script type=text/javascript> function do_stuff_on_load {
4
143983
by: Madhavi | last post by:
Hi Is there any Do Until Loop in C# Maadhavi
3
11871
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 the IP is pingable (true) image A is displayed if it is not (false) then image B is. The code i am using is as follows Dim IPAddress As String = "192.168.1.122"
5
9289
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 records from an external Oracle source using a SQL statement. The SQL statement works as expected when the loop code is commented out, but I receive an error "SQL command not properly ended" when the loop is active. Do Until intLoop = UserNum ...
0
8896
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9451
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8328
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6869
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3395
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.