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 | 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 20th, 2007, 06:29 PM
Authorized User
Join Date: Dec 2006
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to make subroutine code automatically execute

I have a VB 6 project where I had some code that I used to execute by clicking a button on the form, and I've 'cut-and-pasted' that code, it's related subroutines it calls, and the form_load coad into a new project.

In this new project, I want the main subroutine which used to be invoked by a button click, I'll call it for now:

Sub CodeToAutomaticallyRunAfterFormLoadCompletes()

to Automatically run as soon as the form_load routine completes and the form is displayed on the screen. I have a Status box in this form that communicates info to use user.
I also need this Sub to not be interruped by anything in it's execution, ie, if the user minimized or switches away focus from the window, and I only need this Sub to run one time...when it's done, the form should close.

How do I setup my project code so that this will happen?

thanks in advance for your help!

Reply With Quote
  #2 (permalink)  
Old February 21st, 2007, 03:11 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

hi david
I answer you in another forum I guess :)

"There are two ways to write error-free programs. Only the third one works."
Reply With Quote
  #3 (permalink)  
Old February 24th, 2007, 11:20 AM
Friend of Wrox
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts

It is unclear to me exactly what you are asking.

I assume that you do not want to call this from the form_load event because the sub routine uses UI elements of the form that are not comletely initialized until after the form is loaded.

The code for this could be put into the form_activate event handler. Since the method will cause the form to close once it is done with all its processing, the user will never be able to minimize or click away from the form.

I suspect there are problems due to the way your method is written.

What have you tried, and what is your code supposed to be doing?

Woody Z
How to use a forum to help solve problems
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
Resolved! - code behind button won't execute dartcoach Access VBA 1 February 4th, 2008 06:17 PM
Execute Code Once Only brettk_1 Classic ASP Professional 5 May 29th, 2006 09:31 AM
can't execute code from a freed script violetcrystal Javascript 4 April 21st, 2006 05:04 AM
Any code for automatically inserting queries of fi gilgalbiblewheel Classic ASP Databases 9 September 4th, 2004 12:12 PM
Make child close automatically after 3 seconds sherbir Javascript 2 August 25th, 2004 11:24 PM

All times are GMT -4. The time now is 02:58 PM.

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