Adding a Property to a Form? 
Author Message
 Adding a Property to a Form?

I would like to add a couple of properties to a form (similar to the
"Tag" property).  Currently, I am dynamically creating child forms in a
subroutine that has a statement similar to: "Dim NewForm as
frmTypeName".  In this same routine, I would like to create 2 new
properties for the form being created.  I would like these new
properties to basically be like the ".Tag" property that forms currently
have to hold info for the form.  I have looked at VB's on-line help and
am lost.

How can I add new properties to a form that are accessible when I type
the form name and a "." (ie.  Form1.MyNewProperty)?  Any help would be
grealty appreciated.

Thank you,

Nelson Lopes



Sun, 16 Sep 2001 03:00:00 GMT  
 Adding a Property to a Form?

If you don't want anything special then all you need is

    Public mstrNewProperty As String

at the top of the code, under Option Explicit and before the first procedure.
--

Simon Jones
MillStream Designs Ltd
Independent IT Consultants

  How can I add new properties to a form that are accessible when I type
  the form name and a "." (ie.  Form1.MyNewProperty



Sun, 16 Sep 2001 03:00:00 GMT  
 Adding a Property to a Form?
The properties have to be coded into the child forms, they can not
easily be 'created' while the program is running.

In your child forms add two public variables of the type you need:

[Child form code module]
Option Explicit

Public MyTag1 As String
Public MyTag2 As Varient

Then use them as you would the forms actual Tag property.

Thats the simple method, you can specifically create a method
(Example Form1.Print "Hello world") in a child form where you get
a little more control as to what goes on when the method is called.
From Insert Procedure, choose property.  Also look at the Property
Get, Propertry Let, and Property Set examples in Help...

LFS

Quote:

> I would like to add a couple of properties to a form (similar to the
> "Tag" property).  Currently, I am dynamically creating child forms in a
> subroutine that has a statement similar to: "Dim NewForm as
> frmTypeName".  In this same routine, I would like to create 2 new
> properties for the form being created.  I would like these new
> properties to basically be like the ".Tag" property that forms currently
> have to hold info for the form.  I have looked at VB's on-line help and
> am lost.

> How can I add new properties to a form that are accessible when I type
> the form name and a "." (ie.  Form1.MyNewProperty)?  Any help would be
> grealty appreciated.

> Thank you,

> Nelson Lopes



Tue, 18 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Adding New Properties To The Form Controls

2. Adding a Property to ALL forms

3. Windows forms designer automatically adds code that sets properties of custom controls

4. Adding a custom property to a form

5. using a form to add to File>Properties in Word

6. Form Dynamic property , app Dynamic property ?

7. Adding a control to a windows form from an add-in

8. Adding a Form to a VB Add-In at Run time

9. How to add code to form and controls from my Add-In

10. how to change properties of the main form from a another form

11. prohibit form designer to call a property on a form

12. Changing form-properties while running before loading the form

 

 
Powered by phpBB® Forum Software