473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Form not showing until File Functions complete

In my main sub routine I have code similar to this

Form.Show
Call File_Routine

The file routine searches for a configuration file, needed by the program.
If the configuration file is not found then the file routine continues to search for certain files so that there paths can be stored in a newly created configuration file. While the program searches for the files, I am trying to display progress messages to the user.


The problems I have are the Form does not completly load before the File Routine is invoked, it looks like a ghost form. Only after the file routine is complete does the form completely show. Because of this I cannot display the progress messages to the user.( I was using a hidden text box on the form to display the messages, making it visable when needed). I tried this both with a startup form and on the main form.
I've also tried displaying a msgbox (which i really don't like) so that the user has to press ok before the file routine starts. This allows my form to load, and display some text, but as soon as the user presses the OK button the text disappears and none of the other progress messages display.

Please Help!
Sep 20 '07 #1
3 1411
In my main sub routine I have code similar to this

Form.Show
Call File_Routine

The file routine searches for a configuration file, needed by the program.
If the configuration file is not found then the file routine continues to search for certain files so that there paths can be stored in a newly created configuration file. While the program searches for the files, I am trying to display progress messages to the user.


The problems I have are the Form does not completly load before the File Routine is invoked, it looks like a ghost form. Only after the file routine is complete does the form completely show. Because of this I cannot display the progress messages to the user.( I was using a hidden text box on the form to display the messages, making it visable when needed). I tried this both with a startup form and on the main form.
I've also tried displaying a msgbox (which i really don't like) so that the user has to press ok before the file routine starts. This allows my form to load, and display some text, but as soon as the user presses the OK button the text disappears and none of the other progress messages display.

Please Help!
Two choices:

You can REFRESH the form, before the routine:

Form1.Refresh.

And/Or, you can use a "DOEVENTS" keyword.

In the loop where you search for files, add "DoEvents"
This will yield to other processing (like fully loading your form).

You could also combine the above:

Form1.Refresh
Call FileRoutine

Public Sub FileRoutine()
Do While SearchingForFile
Doevents
... whatever your code is here
loop
End Sub
Sep 20 '07 #2
In my main sub routine I have code similar to this

Form.Show
Call File_Routine

The file routine searches for a configuration file, needed by the program.
If the configuration file is not found then the file routine continues to search for certain files so that there paths can be stored in a newly created configuration file. While the program searches for the files, I am trying to display progress messages to the user.


The problems I have are the Form does not completly load before the File Routine is invoked, it looks like a ghost form. Only after the file routine is complete does the form completely show. Because of this I cannot display the progress messages to the user.( I was using a hidden text box on the form to display the messages, making it visable when needed). I tried this both with a startup form and on the main form.
I've also tried displaying a msgbox (which i really don't like) so that the user has to press ok before the file routine starts. This allows my form to load, and display some text, but as soon as the user presses the OK button the text disappears and none of the other progress messages display.

Please Help!
one other advantage with DoEvents,

without it, you have a 'frozen form'. Users wont be able to move or click anything until your loop completes.

Using DoEvents, there is no 'freeze'. this is good if you dont want users to do anything. But, bad if Users have to wait. They will think the app is not responding.
Sep 20 '07 #3
Thanks I will give them both a try.
Sep 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: tyler_durden | last post by:
hi there peeps... like I say in the topic, I need to do an e-mail program in C language, and has to be made until the 3th of january..the problem is I'm having some problems with it. I was...
4
by: anders | last post by:
I have a 'solution' with a Webservice, Business layer and a data layer. In the Business layer I've added a form that need to be started on the server(this site has full rights, runs with Local...
7
by: anthony | last post by:
I tried sth i did b4 in VB, now in VB.NET, but since the form is created every time, the following code would not work because MsgBox.Visible is always false, any idea? Thanks! Public...
7
by: GeorgeAtkins | last post by:
I want to create a web-based form or page that consists of a series of formatted questions and answers. The form will resemble an existing paper form. When the form is filled in, I want the user to...
6
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user double-clicks the button or just gets impatient and...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? -----------------------------------------------------------------------...
11
by: Alex | last post by:
Hello all, I have a main form(say "form1") .i want to display another form(say "form2") on occuring of an event (say a button click) and want to hide it after some time so that it will again...
4
by: Franck | last post by:
I'm a vb programmer but i have to touch C# a bit now. I'm looking for a thing that doesn't seems to exist anywhere here im talking of how to open a form. in vb it was just frmMyform.show or...
0
by: SilentCodingOne | last post by:
I'm creating an application that allows the user to create, edit and begin to post ads to Craiglist. I have everything but the begin to post the ad portion complete and cannot seem to get it to work....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.