Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Helllp!!! :-) About using a method from a Dll...

Helllp!!! :-) About using a method from a Dll...

Scheduled Pinned Locked Moved C#
helpcsharpoopquestion
16 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Azad Giordano Ratzki

    You're the kind of people that make people shy away from using forums- let us take the following example: I ask (trusting that someone with your wisdom in this language will help me, offer a hint in the right direction, or give an example): What is 2+2. You say: It would be better if you understood what addition is before moving on to advanced topics. I can understand that understanding these topics better would help me, that's why I'm here. The method in the code I posted works fine from within the same namespace just when I make it into a DLL and try and use it and the arguments reference a class and method from outside the DLL it doesn't work, so I guess what I need to do is figure out how to make the dll see the class or namespace that is calling the method from within it...if you can help me and offer up anything that is actually considered help it would be much appreciated. :) I also understand that I am probably not explaning this very well, but what I am looking for is someone who has run into a similiar problem and what their solution was for it.

    L Offline
    L Offline
    led mike
    wrote on last edited by
    #7

    You're the kind of people that think they can learn to run before they learn to walk- let us take the following example: wait I have an idea that is a more appropriate use of my time.... :zzz:

    A 1 Reply Last reply
    0
    • L led mike

      You're the kind of people that think they can learn to run before they learn to walk- let us take the following example: wait I have an idea that is a more appropriate use of my time.... :zzz:

      A Offline
      A Offline
      Azad Giordano Ratzki
      wrote on last edited by
      #8

      Finally something we agree on, next time don't post a response to someone's question unless it's to offer help. These kind of responses devalue the title of MVP. :(

      L L 2 Replies Last reply
      0
      • A Azad Giordano Ratzki

        Finally something we agree on, next time don't post a response to someone's question unless it's to offer help. These kind of responses devalue the title of MVP. :(

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #9

        Taicho2k wrote:

        the title of MVP.

        When you become one then you can tell me all about it ... until then ...

        Taicho2k wrote:

        unless it's to offer help.

        I did offer help, you didn't like it, so what it was free.... so once again.... fuck off loser

        N 1 Reply Last reply
        0
        • A Azad Giordano Ratzki

          Finally something we agree on, next time don't post a response to someone's question unless it's to offer help. These kind of responses devalue the title of MVP. :(

          L Offline
          L Offline
          leckey 0
          wrote on last edited by
          #10

          Don't tell people who have more experience than you what to do. Period. And while you are at it read the forum guidelines. Message titles should not include words 'urgent' or 'help.'

          ______________________ stuff + cats = awesome

          1 Reply Last reply
          0
          • A Azad Giordano Ratzki

            Ok so here's the problem.... I have a solution that contains 2 projects one is the executable and the other is a DLL that I wrote that the application uses... the problem is that method I am using from the dll tries to reference a class and/or method from the application but since it isn't referenced I get an error here is the code: Application code: AnyMethod.RunMethod("ProcessModules","Menu"); //ProcessModules being a class in the application. DLL code: public static void RunMethod(string myClass, string myMethod) { Type myType = Type.GetType(myClass); MethodInfo myMeth = myType.GetMethod(myMethod); myMeth.Invoke(null,null); } Any ideas? I have a feeling this would use some inheritance feature or something but not sure...still very new to C#...There has to be a way the dll can reference a class in my other namespace without having to hard-code the reference right??

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #11

            Taicho2k wrote:

            since it isn't referenced I get an error

            Standard question #2: What error message do you get?

            Taicho2k wrote:

            There has to be a way the dll can reference a class in my other namespace without having to hard-code the reference right?

            Then you have to load the assembly from the dll.

            --- single minded; short sighted; long gone;

            A 1 Reply Last reply
            0
            • G Guffa

              Taicho2k wrote:

              since it isn't referenced I get an error

              Standard question #2: What error message do you get?

              Taicho2k wrote:

              There has to be a way the dll can reference a class in my other namespace without having to hard-code the reference right?

              Then you have to load the assembly from the dll.

              --- single minded; short sighted; long gone;

              A Offline
              A Offline
              Azad Giordano Ratzki
              wrote on last edited by
              #12

              When you say "load the assembly" do you mean like [DllImport]? If so, I am currently trying to use DllImport and it finds the DLL, however, it says it can't find the entry point in the DLL, and I've made the function I'm importing the same name as the method in the DLL so I thought it would find it and it doesn't, so then I tried to specify the entry point by doing [DllImport("myDll.dll", Entrypoint="myMethod")] public static extern void myMethod() and it still can't find the "entry point" when I run the method in the code later? Do I have to specify something within the DLL? Thanks for the help, Taicho

              1 Reply Last reply
              0
              • A Azad Giordano Ratzki

                Ok so here's the problem.... I have a solution that contains 2 projects one is the executable and the other is a DLL that I wrote that the application uses... the problem is that method I am using from the dll tries to reference a class and/or method from the application but since it isn't referenced I get an error here is the code: Application code: AnyMethod.RunMethod("ProcessModules","Menu"); //ProcessModules being a class in the application. DLL code: public static void RunMethod(string myClass, string myMethod) { Type myType = Type.GetType(myClass); MethodInfo myMeth = myType.GetMethod(myMethod); myMeth.Invoke(null,null); } Any ideas? I have a feeling this would use some inheritance feature or something but not sure...still very new to C#...There has to be a way the dll can reference a class in my other namespace without having to hard-code the reference right??

                L Offline
                L Offline
                Leslie Sanford
                wrote on last edited by
                #13

                Taicho2k wrote:

                I have a solution that contains 2 projects one is the executable and the other is a DLL that I wrote that the application uses... the problem is that method I am using from the dll tries to reference a class and/or method from the application but since it isn't referenced I get an error here is the code:

                Ok, I'm not clear on what you're trying to do, but it sounds like you have a circular reference. You have an executable that uses an assembly and an assembly that tries to use the executable. Correct? The solution lies in breaking the circular reference.

                1 Reply Last reply
                0
                • L led mike

                  Taicho2k wrote:

                  the title of MVP.

                  When you become one then you can tell me all about it ... until then ...

                  Taicho2k wrote:

                  unless it's to offer help.

                  I did offer help, you didn't like it, so what it was free.... so once again.... fuck off loser

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #14

                  led mike wrote:

                  f*** off loser

                  Come now we can be better than this.


                  only two letters away from being an asset

                  M 1 Reply Last reply
                  0
                  • N Not Active

                    led mike wrote:

                    f*** off loser

                    Come now we can be better than this.


                    only two letters away from being an asset

                    M Offline
                    M Offline
                    Martin 0
                    wrote on last edited by
                    #15

                    Mark Nischalke wrote:

                    Come now we can be better than this.

                    Good statement! (Got my 5) I don't know if it should be the responsability of a CP MVP which shouldn't let him make this kind of statements. But for me, vulgaritys and personal abuse have no place in a forum like this! All the best, Martin

                    N 1 Reply Last reply
                    0
                    • M Martin 0

                      Mark Nischalke wrote:

                      Come now we can be better than this.

                      Good statement! (Got my 5) I don't know if it should be the responsability of a CP MVP which shouldn't let him make this kind of statements. But for me, vulgaritys and personal abuse have no place in a forum like this! All the best, Martin

                      N Offline
                      N Offline
                      Not Active
                      wrote on last edited by
                      #16

                      Thank you, you are correct vulgaritys and personal abuse have no place in this community no matter who they are from.


                      only two letters away from being an asset

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups