Activator.CreateInstance basic how-to-use RRS feed

  • Question

  • I have just found Activator.CreateInstance and I think it's what I want, but I don't fully understand how to use it.

    If I want to create a (default) instance of an object with no parameters, I believe I should use

    Dim theObject = Activator.CreateInstance(ObjectType)  ' Is this right?

    If so, how do I create one WITH an parameter?  

    Dim ParamenterisedObject = Activator.CreateInstance(ObjectType(theArgument))

    Thanks for your help

    David Gordon-Brown

    • Edited by David GB Friday, August 9, 2013 4:24 PM
    Friday, August 9, 2013 4:23 PM