Results 1 to 5 of 5

Thread: CType question

  1. #1

    Thread Starter
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306

    CType question

    I've been a good boy and have Option Strict = on. However I've now run into a snag.

    I need to access a property from a dynamically added user-control, normally I would use something like

    VB Code:
    1. CType(usrControl,usrControlType).Property = Value

    Problem is, in the bit of code I need to do this, I do not know what type of control I am accessing.

    Is there I way I can get the type for use with CType? I've tried a couple of ideas but no success yet.

    thanks

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Use reflection

  3. #3

    Thread Starter
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    Can you briefly explain what reflection is please?

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Reflection is the ability to get an objects type, methods and members at runtime. Thats how intellisense is implemented. It is a powerful feature. You can even create a new exe or dll at runtime.

  5. #5

    Thread Starter
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    I've worked around my problem but I deffo think I'll look into reflection. I found some good stuff from searching with google but it all seemed far too much for the 'simple' result I want.

    Still, thanks for your help

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