adding a dll

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • willywonka
    New Member
    • Sep 2007
    • 18

    adding a dll

    Hi All,

    I am trying to add a dll to my .net project.

    I have added a reference to the dll(from .net project) through browse and although the name of the dll shows up under references none of the classes are there and i am not able to use any of the methods from it. I am not sure if i am adding the dll correctly. Could you please advise on what i am doing incorrectly and how to sucessful add this dll to my project.

    Thanks in advance :) !!!
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Have you added the namespace?

    If the dll project is in the same solution as your current project, going to "add a reference" there is a tab for "projects"
    Otherwise you would go to the .net tab and browse for it (I believe that is what you said)

    If you right click on your dll in the solution explorer and chose view in object browser, what is in there? What namespace does it use? What class names?

    Comment

    • willywonka
      New Member
      • Sep 2007
      • 18

      #3
      Hi there! u really seem to be answering my question, very much appreciated!

      When i right click on the dll and choose view in object browser i see my dll name and if i open it under all the classes r there. Does that mean i should be able to reference them? From my little use of vb.net i have noticed that as soon as u put a period (.) the method names avaible to u usually show up but none of the methods from the dll do.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Well your dll will probably have a different namespace then your current project.
        if your dll is called "mydll.dll" then the namespace is probably "mydll"

        So you would use something like:
        [code=vbnet]
        Dim myc = new mydll.myclass()
        [/code]

        Comment

        • willywonka
          New Member
          • Sep 2007
          • 18

          #5
          Thanks so much Plater!!!

          Now i just wanted to know how to refer to the methods in my class on the new dll object would i type:
          myc.method name?
          I have tried that but it doesn't seem to work
          this last piece of information would really be appreciated!!!

          Also i have tried declaring the namespace @ the top of my class:
          using namespace;
          but i get an error saying u statement cannot appear outside of class.

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            If you are in C# it is "using" if you are in vb.net it's something else I think.

            If you can create an instance of your class, that you should be able to use it normally.

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              Originally posted by Plater
              If you are in C# it is "using" if you are in vb.net it's something else I think.

              If you can create an instance of your class, that you should be able to use it normally.
              Imports NameOfDll

              :)

              Comment

              • willywonka
                New Member
                • Sep 2007
                • 18

                #8
                Thank you Frinavale :) !
                Now i just need to know how to access my methods in vb.net. I have the imports dll @ the top

                dim test = New Testing
                test.method

                but the method names are not showing up after the period, am i declaring it wrong? how would i do it? very grateful for all the help so far!

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  Originally posted by willywonka
                  Thank you Frinavale :) !
                  Now i just need to know how to access my methods in vb.net. I have the imports dll @ the top

                  dim test = New Testing
                  test.method

                  but the method names are not showing up after the period, am i declaring it wrong? how would i do it? very grateful for all the help so far!

                  Try:

                  [code=vbnet]
                  Dim test As New NameOfDll.Testi ng
                  test.method
                  [/code]

                  Comment

                  • willywonka
                    New Member
                    • Sep 2007
                    • 18

                    #10
                    Yippy!!!!!!!!! Thank you so much Frinny for all ur help!!! It works and now i can continue with my work and not get in trouble!!!

                    Comment

                    • Frinavale
                      Recognized Expert Expert
                      • Oct 2006
                      • 9749

                      #11
                      Originally posted by willywonka
                      Yippy!!!!!!!!! Thank you so much Frinny for all ur help!!! It works and now i can continue with my work and not get in trouble!!!

                      Good stuff!


                      Happy coding :)

                      -Frinny

                      Comment

                      Working...