Ok, there are two ways you can do it.
1) If your forms are standalone. Meaning they are all by themselves. Self contained.
Start VB, and start an "Active X DLL" project. Right click on the project and say "Add new Form". Then just design your form as normal.
In the Class portion of the dll make a sub called ShowMyForm or something like that. Then set your form to visible. Then just hide it when the form is done doing it's work.
VB Code:
Public Sub ShowCustomForm Form1.Visible=True End Sub
All the things in the form inside the DLL will not be visible to programs that actually USE the DLL. But they are visible to the class that makes up the DLL.
So you can make properties for everything you want to expose to the calling program.
Like say you have a checkbox on the form inside your DLL. You could do this in your class
Or lets say you wanted to set a property on that form. Like the title of the formVB Code:
Public Property Get FormsCheckBox() as Boolean If Form1.Checkbox1.Value = True Then FormsCheckBox = True Else FormsCheckBox = False End If 'Written just to demoncstrate code in Propery. It could easily have been just: ' FormsCheckBox = Form1.Checkbox1.Value End Property
VB Code:
Public Property Let FormTitle(Value as String) Form1.Caption = Value End Property
Then in the calling application, you would have access to those methods of the class. You will have to include your DLL in the Project->References menu.
VB Code:
Dim MyClass As YourClass Set MyClass = New YourClass MyClass.ShowCustomForm If MyClass.FormsCheckBox = True Then 'Do Something End If MyClass.FormTitle = "Testing123"
You will also have to register the DLL on any system that uses it. But the Package and Deployment Wizard helps you make the setup programs needed.
Now if you want to make a standard set of controls that are linked in some way, and put them on various forms in the future. Then you want to select the "ActiveX Control" project type at VB startup.
These are more difficult to do, but really cool![]()





Reply With Quote