|
-
Nov 25th, 2005, 07:25 AM
#1
Thread Starter
Member
Making A GUID BASED DLL
I have made some forms, which are so generic for my future applications as well, i thought to make those GUI form as DLL so that i dont have to waste my time in development of new project by callin the already made forms which'll be stored as dll.
I want a lil help. Can you tell me is this a good idea? moreover, i don't have any idea how to make a dll in VB, can any one of you point or paste a good tutorial to make a very efficient professional dll.
-
Nov 25th, 2005, 07:31 AM
#2
Fanatic Member
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.
r0ach™
Don't forget to rate the post
-
Nov 25th, 2005, 08:43 AM
#3
Hyperactive Member
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
Last edited by umilmi81; Nov 25th, 2005 at 08:58 AM.
-
Jan 8th, 2006, 02:26 PM
#4
Thread Starter
Member
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|