Results 1 to 7 of 7

Thread: [2008] Help with DLLS

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    [2008] Help with DLLS

    Good morning everyone,

    I have never used my own dlls putting classes into DLLs and using them and I have decided to do it with this program as it is such a big program.

    I have designed my class as it was with the program declaring some varibles as Public and the a Public Sub and I want my program to be able to fill the varibles with something then run the Public sub which will do all its work then fill another couple of varibles itself then when finished my program needs to read those varibles that the DLL filled out itself.

    As I have done this before I wasn't sure how to do it so did it like normal I created the DLL then put a Reference into my program to use it but then of course I can't see the varibles I have declared it just cant use the DLL. When speaking to my mate he said I need to put something special in the top of the DLL in order to use it and told me to look online and find an example one.

    I was wondering if anyone here could help me. What do I need to put in the DLL to use it in my program and is there anything that I need to put in the top of my form or anything??

    Thanks,
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  2. #2
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: [2008] Help with DLLS

    Your post is a little confusing but it sounds like you are just putting variables in a dll project?

    when you make dlls you put classes in them, which you instantiate like normal, or give them 'public shared' functions etc for use without an instance.

    Basically, a dll project is essentially no different from just having class files in your project, except that they are kept in different namespaces (can have diff references etc) but you go about using them the same way.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] Help with DLLS

    You shouldnt be trying to fill these "public variables" from your program. Create some Public Properties or Functions/Methods and fill / access them from there.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: [2008] Help with DLLS

    Ok Well it doesn't seem to work Here is whats in my DLL:

    Authentication.Class

    Code:
    Public Class Authentication
    
        Public AuthenticationType As Integer
    
        Public Username As String
        Public Password As String
    
        Public Level As String
    
        Public DatabasePath As String
    
        Public Authenticated As Boolean
    
    
        Public Sub Authenticate()
    
    ' MY WORKING CODE GOES HERE       
    
        End Sub
    
    End Class
    Then I simply open my main project Add Reference to it then open my form and try to use the DLL. It sees the DLL but I am not sure how to use it. I have attached a screenshot to show you what my form does when I try to use it. Its prob just me being stupid. If I used it like I normally do:

    Code:
    MyVarible = ThisValue
    And I would normally just put that in the form where the varible is in a Module

    when I do that here it just says its not declared.


    My mate is a profressional programmer and he said there was a little bit of code that needs to go at the top of the dll in order for vb.net to be able to use varibles in it.
    Attached Images Attached Images  
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: [2008] Help with DLLS

    Don't Worry I have managed to do it myself playing around with it. I have never really used classes or DLLs so playing around I managed to do it. For those of you in my situation which will prob be none I had to do this:

    Inherits Global.DLL.CLASSNAME

    So in my case it was:

    Inherits Global.Authentication.Authentication

    Because my DLL Project was called Authentication and My class in the DLL was called Authentication. :-)
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2008] Help with DLLS

    Ok, but I still stand by my post that its not the best design logic to use for a dll. A dll should be just functions, methods and subs.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2006
    Location
    UK / East Sussex
    Posts
    1,054

    Re: [2008] Help with DLLS

    Nope its messed it up. Iafter adding tht code my actual form as just gone. I only have the code to the form and i can't seem to get it back. I have just lost two whole forms. Anyway of getting it back?

    What the hell have I done wrong?

    RobDog888 Please could you give me examples of what you mean and how to do it as it doesn't make much sense to me. I am prob seeming really dumb right now but its something I need to get done.


    Thanks.
    M.Carpenter

    Server Admin for Wurm Online
    Wurm Online - A very unique and original MMO from Code Club AB
    https://www.youtube.com/watch?v=YQlYar2uHWAWurm Trailor


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