Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 12th, 2006, 11:03 PM
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kevsboy
Default how about cancel a process

I am currently working on an application where it converts a CSV infile into another format of CSV outfile. In a nutshell, the application reads#12288;from the infile, then process (around 10thousand records), then writes to an outfile. The routine process the input line by line.

Private Sub convertFile(textBoxNumber As String)
   Do Until EOF(1)
     'read the file, then process, then write
end sub

What if during the process, the user wants to cancel the job? I tried putting a DoEvent with a GetInputState inside the Loop:

Private Sub convertFile(textBoxNumber As String)
   Do Until EOF(1)

     If GetInputState() <> 0 Then
       If MsgBox("Conversion Completed upto routine " & i & ". Cancel the rest?", vbQuestion + vbYesNo) = vbYes Then EXIT SUB
     End If

     'read the file, then process, then write
end sub

It did catch the key press event, but the problem is, it catches the key pressed after the loop was done. Defeats the purpose because what if the infile is really big. What I am hoping for is some what a real time action on the key press.

Thanks for the advice. If my approach seems to be wrong or absurd, that's because I am a new user of VB. Please excuse me. Thanks guys!

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
process.startinfo opens new instance of process Anypond General .NET 0 August 28th, 2008 05:35 AM
cancel appointment jeanhl BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 25th, 2008 03:55 AM
How can I cancel deleting ? ALGNET ADO.NET 1 March 22nd, 2006 01:55 PM
Cancel a keystroke Kenny Alligood Access 4 June 12th, 2003 10:02 AM

All times are GMT -4. The time now is 01:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.