Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2007, 06:29 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to make subroutine code automatically execute

hello,
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!
david

 
Old February 21st, 2007, 03:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

"There are two ways to write error-free programs. Only the third one works."
Unknown
 
Old February 24th, 2007, 11:20 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
http://www.learntoprogramnow.com
How to use a forum to help solve problems





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





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