Re: Making A GUID BASED DLL
Hmmmm..... I've never thought about this before, but here's what I know:
A UserControl can hold forms. If they are never going to change, put them in a user control. Make the control small (like the timer control), and set the InvisibleAtRuntime property to True. Put the forms in there, and make methods to display each form.
This will give you a control like the Common Dialog control, which you can just throw on a form, and call the other windows from.
Re: Making A GUID BASED DLL
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
VB 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
Or lets say you wanted to set a property on that form. Like the title of the form
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 :)
Re: Making A GUID BASED DLL
umilmi81
First of all thanks for help. i am sorry that i have not practiced it yet, but i guess it'll work. but i have a few question to ask ...
- first of all, can you tell me how will i load the dll in my main form ...?
- let me write the scenario, and tell me the method you have posted will work for it.
Scenario
I have a form, which takes the personal information. so i make the .dll file of this form name personal.dll, by the method you told.
Now i am making a project, name Purchase ... i have an MDI form here, in which there is a menu, name enter personal info ... on it's click event ... i load the personal.dll which is placed in the same directory where the MDI form is placed ... will this work to get the information ..?
- how can i send some information to the loaded .dll ... i.e. i want to set the value for some fields which are in the personal.dll ... how can i?