Click to See Complete Forum and Search --> : CreateObject in C#


MGunawan
05-25-2005, 09:28 PM
dear all;

Iam used a VB programmer and some time I use this statement

Set oServerComp = CreateObject("Data.Customer",MyServerName)
oServerComp.AddNew Bla bla

does any one know, how do that in C#?

Thank's

Phil Weber
05-25-2005, 09:44 PM
Type objClassType;
objClassType = Type.GetTypeFromProgID("Data.Customer");
objApp_Late = Activator.CreateInstance(objClassType);

objApp_Late.GetType().InvokeMember("AddNew",
BindingFlags.InvokeMethod, null, objApp_Late, null);

For more information, see http://www.google.com/search?q=c%23+late+binding