Results 1 to 4 of 4

Thread: Making A GUID BASED DLL

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2005
    Posts
    45

    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.

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    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

  3. #3
    Hyperactive Member umilmi81's Avatar
    Join Date
    Sep 2005
    Location
    Sterling Heights, Mi.
    Posts
    335

    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:
    1. Public Sub ShowCustomForm
    2.   Form1.Visible=True
    3. 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:
    1. Public Property Get FormsCheckBox() as Boolean
    2.       If Form1.Checkbox1.Value = True Then
    3.            FormsCheckBox = True
    4.       Else
    5.            FormsCheckBox = False
    6.       End If
    7. 'Written just to demoncstrate code in Propery.  It could easily have been just:
    8. '  FormsCheckBox = Form1.Checkbox1.Value
    9. End Property
    Or lets say you wanted to set a property on that form. Like the title of the form
    VB Code:
    1. Public Property Let FormTitle(Value as String)
    2.   Form1.Caption = Value
    3. 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:
    1. Dim MyClass As YourClass
    2. Set MyClass = New YourClass
    3.  
    4. MyClass.ShowCustomForm
    5. If MyClass.FormsCheckBox = True Then
    6.  'Do Something
    7. End If
    8. 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.

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2005
    Posts
    45

    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 ...


    1. first of all, can you tell me how will i load the dll in my main form ...?
    2. 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 ..?
    3. 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
  •  



Click Here to Expand Forum to Full Width