Why use a module when you have a form...

UCM

Well-known member
Joined
Jan 1, 2003
Messages
135
Location
Colorado, usa
Just in case any of you out there were curious as to an answer for this question, heres some things to think about:
* If you use a form instead of a module then you CAN hide it if it is the startup object in your project
* Since your startup object would be a form instead of a module, you can quickly and easily add things like system tray icons as well as context menus on these icons
* With a form set up as your startup object, you can create other forms in code from this form just like you could if you used a module

There are Im sure many many other great reasons to choose forms over modules.

Now on to the big question, "How do I make my startup form invisible at startup??" The answer is much simpler than to be expected:

First, lets make form1 the startup form in project properties

Second, set form1s controlbox property to False

Third, set form1s formborderstyle property to None

Fourth, set form1s size to the minimum it can be, 8, 8

Fifth, set form1s transparancy key as well as form1s backcolor property to Control ( In the System colors tab )

And Sixth, add the following code to the form_load event on form1:
Code:
    Me.Top = 4
    Me.Left = 0
Note: There is no need to use Me.Hide() since it will have no effect

Note: If you want to hide the form from the task bar then just make form1s showintaskbar property to false, you can use the form1.text property as much as you like.

Result is that form1 now has control just like normal, except that it doesnt appear on the screen at all thus giving you full control over any form related OOP and form control benifits while removing any need for a module...
 
Forgot to mention that you could even add data components to this form as well as timers to make it easy to manipulate data and use time in your applications...

The possibilities are extreme...
 
Back
Top