Results 1 to 15 of 15

Thread: Dymanic load DLL

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36

    Dymanic load DLL

    HI all,

    I created an apllication and a dll.
    Can somebody provide me a simple piece of code, how to load the dll and load a form created in the dll and how to unload the dll after closing the form inside the dll.

    Thanks,

    AXH

  2. #2

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    Can somebody help me with this ??

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Well , I don't know what is this form you want to load from the dll . Is this dealing with plugins archit. ?

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    Just a normal windows form

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    In what lang did you write that dll ?

  6. #6

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    vb.net (class library)

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    OK , the general idea of loading a dll is as follow :

    First , reference your dll by right clicking on the Reference item in the project explorer . Browse to your dll . Click Select and then OK .

    Secondly , import your dll in your form or whatever by typing first the namespace something like this :
    VB Code:
    1. Imports MYAPPLICATION.MyClassForm

    Thirdly , Instantiate an obj and use the methods inside it as you do with anyother obj in .NET .

    VB Code:
    1. Dim MyCls As New MyClassForm
    2. MyCls.Your methods here

    I still don't know if this would help you in anyway .

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    Thanks, it's working

    By the way,

    I will split up my program by using dll's.
    Is there a program or a something else to check if the dll is available so I can catch the fault message and write a program to download the specific download.

    Thanks again

    AXH

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Umm , what do you mean by splitting up your app into dlls ?

  10. #10

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    I will split up my program up in for example query / export /import / maintenance
    So I thought I will make four seperate dll's

    Not a good idea ? or do you have a other option

    AXH

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    For me , I wouldn't bother making 4 dlls . You have either these options :
    1-Pack your Classes & Functions into one dll .
    Or
    2-Put them in separate modules , let's say 4 modules if that's possible in your case .

    Advantage of the second option :
    1-Faster when making updating , corrections , addition , deletion ...etc to the source code .
    2-Much more eaiser when deploying your app . No need to look for the dlls , no possiblity of losing your dlls (i.e can't delete these dlls )

  12. #12

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    Why is there no need for looking for dll's
    Before I start the program and I will move the dll or rename the dll I will get an exception error!

  13. #13
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by ahollaar
    Why is there no need for looking for dll's
    Before I start the program and I will move the dll or rename the dll I will get an exception error!
    Because the file name has been changed either by its name or the location and is no longer accessible from your proj . In this case if you did any of the above operation you have to re-reference the file .

  14. #14

    Thread Starter
    Member
    Join Date
    Sep 2003
    Location
    Amsterdam, Holland
    Posts
    36
    And for example a stupid user delete / moved the dll what todo then. The progrma will generate an error

  15. #15
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Yes .

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