home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,402 of 10,840   
   Jan Hyde to All   
   Re: Waiting until loop finished.   
   05 Feb 07 16:25:08   
   
   From: StellaDrinker@REMOVE.ME.uboot.com   
      
   "A.G.van Staveren" '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."   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca