Set properties for forms globally

pettrer

Well-known member
Joined
Sep 5, 2008
Messages
92
Programming Experience
10+
Hi,

I wonder if there is a way to easily set the settings of opened forms globally. Now, I set the ShowInTaskbar property to false, to take one example, but I need this to be the case for say ten different properties and have LOTS of forms.

I guess I could call a global sub from the form's Load sub (such as formProperties(Me)), but is there an easy way to do this for all forms?

Best,

Pettrer
 
Create one form from which your other forms will inherit. The designer even supports this :)

Go to ADD NEW.. ITEM to your project. Add a windows form. Set the properties you want. Now go to ADD NEW.. ITEM.. and add an Inherited Form. Specify the parent form. Now that form has all features of parent form, like titlebar text, even controls etc
 
Great!

This works very well. One thing though. There is a bug in the framework that causes an inherited form to close immediately if the ShowInTaskbar property is set to false in the page load event of the template form AND the inherited form is opened via ShowDialog. The upside of this bug is that when I deleted the Me.ShowInTaskbar = False code and used the properties window to set the desired behaviour instead, it not only worked (!) but also the inherited form loads faster, as it doesn't need to redraw anymore.

Pettrer
 
Back
Top