\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > how to force VB to strickly execute code line-by-line


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
I\'m writting a program for sorting and editing (large) text files containing lists of random words. During the process, i\'ve used a text field that informs the user in which stage the process is. The code is something like this (i won\'t paste the actual code because it\'s not necessary and it\'s hard to read) when the user presses the button to start the process:
\r\n
\r\nprint "Opening file..." in textfield
\r\nopen .txt file for input
\r\nprint "file opened successfully" in textfield
\r\nprint "reading records..." in textfield
\r\nDo While loop to save .txt records into an array
\r\nprint "Sorting..." in textfield
\r\nsave current time
\r\nrun QuickSort3 module to sort the array
\r\nsave current time
\r\nprint the DateDiff in textfield
\r\n
\r\nThe problem here is that VB is getting ahead of the commands so when I press the button to begin the above process, the program freezes for few seconds (which means it is running the sorting algorithm) and then prints everything in the textfield at once. Even the two "save current time" are saving the exact same time no matter how long it took for the sorting algorithm to do it\'s job.
\r\n
\r\nI have tried to use "DoEvents" in many places in the code with no luck. So, how can I force VB to execute the code line-by-line? I want to see the text in the textfield before the program starts sorting the array!
\r\n
\r\nthank you for your time!
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[1392857] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 04-19-2012, 03:04 PM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
passel\'s Avatar\r\n\r\n
\r\n \r\n passel\r\n passel is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 04-19-2012, 01:56 PM
StorM_GmA StorM_GmA is offline
Regular
 
Join Date: Oct 2007
Posts: 91
Default how to force VB to strickly execute code line-by-line


I'm writting a program for sorting and editing (large) text files containing lists of random words. During the process, i've used a text field that informs the user in which stage the process is. The code is something like this (i won't paste the actual code because it's not necessary and it's hard to read) when the user presses the button to start the process:

print "Opening file..." in textfield
open .txt file for input
print "file opened successfully" in textfield
print "reading records..." in textfield
Do While loop to save .txt records into an array
print "Sorting..." in textfield
save current time
run QuickSort3 module to sort the array
save current time
print the DateDiff in textfield

The problem here is that VB is getting ahead of the commands so when I press the button to begin the above process, the program freezes for few seconds (which means it is running the sorting algorithm) and then prints everything in the textfield at once. Even the two "save current time" are saving the exact same time no matter how long it took for the sorting algorithm to do it's job.

I have tried to use "DoEvents" in many places in the code with no luck. So, how can I force VB to execute the code line-by-line? I want to see the text in the textfield before the program starts sorting the array!

thank you for your time!
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->