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

Using Reflection

Scheduled Pinned Locked Moved C#
question
4 Posts 3 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.
  • J Offline
    J Offline
    JuanAlbertoMD
    wrote on last edited by
    #1

    Hello! I want to "read" a dll file and get all its components, once that i do this i want to load the components into a ComboBox or ListBox, later i can select one of them and insert it into a windows form at run time. I think that maybe i can do this using Reflection but i don't know exactly how. Somebody knows how can i do somethig like this? Regards, Alberto Martinez

    T V 2 Replies Last reply
    0
    • J JuanAlbertoMD

      Hello! I want to "read" a dll file and get all its components, once that i do this i want to load the components into a ComboBox or ListBox, later i can select one of them and insert it into a windows form at run time. I think that maybe i can do this using Reflection but i don't know exactly how. Somebody knows how can i do somethig like this? Regards, Alberto Martinez

      T Offline
      T Offline
      Tom Larsen
      wrote on last edited by
      #2

      Assuming your "dll" is really a .Net Assembly it is entirely possible with Reflection. Just take a look at the System.Reflection namespace. You can load an assembly and call methods or create objects or whatever on the assembly. It isn't for the faint of heart because it involves some advanced topic but what you want is entirely doable in all version of the .Net.

      1 Reply Last reply
      0
      • J JuanAlbertoMD

        Hello! I want to "read" a dll file and get all its components, once that i do this i want to load the components into a ComboBox or ListBox, later i can select one of them and insert it into a windows form at run time. I think that maybe i can do this using Reflection but i don't know exactly how. Somebody knows how can i do somethig like this? Regards, Alberto Martinez

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #3

        It's rather simple to get the types contained in a DLL. I'm writing an article on this and hope to post it by this month end. Here's the relevant code. Does this help? :)

        string secondPlayerPath = secondPlayerTextBox.Text;
        a = Assembly.LoadFile(secondPlayerPath); //TODO: Exception handling here
        types = a.GetTypes();

        If you want, I can tell you when my article goes up. Cheers, Vikram.


        I don't know and you don't either. Militant Agnostic

        J 1 Reply Last reply
        0
        • V Vikram A Punathambekar

          It's rather simple to get the types contained in a DLL. I'm writing an article on this and hope to post it by this month end. Here's the relevant code. Does this help? :)

          string secondPlayerPath = secondPlayerTextBox.Text;
          a = Assembly.LoadFile(secondPlayerPath); //TODO: Exception handling here
          types = a.GetTypes();

          If you want, I can tell you when my article goes up. Cheers, Vikram.


          I don't know and you don't either. Militant Agnostic

          J Offline
          J Offline
          JuanAlbertoMD
          wrote on last edited by
          #4

          Hello!! Yes, i would like to know when your article is ready, thanks! Regards, ALberto Martinez

          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