Click here to Skip to main content
15,913,941 members
Home / Discussions / C#
   

C#

 
Generalforech and strings Pin
Tyrus18226-Dec-04 18:08
Tyrus18226-Dec-04 18:08 
GeneralRe: forech and strings Pin
kaptaintens26-Dec-04 19:38
kaptaintens26-Dec-04 19:38 
GeneralRe: forech and strings Pin
Tyrus18227-Dec-04 8:00
Tyrus18227-Dec-04 8:00 
GeneralRe: forech and strings Pin
Jay Shankar26-Dec-04 19:54
Jay Shankar26-Dec-04 19:54 
GeneralUser Controls Pin
IceFear26-Dec-04 17:30
IceFear26-Dec-04 17:30 
GeneralRe: User Controls Pin
Jay Shankar26-Dec-04 20:08
Jay Shankar26-Dec-04 20:08 
GeneralRe: User Controls Pin
IceFear27-Dec-04 1:12
IceFear27-Dec-04 1:12 
GeneralReflection error Pin
Member 140823826-Dec-04 17:13
Member 140823826-Dec-04 17:13 
This is the piece of code in Early Binding and works as expected.
---------------------------------------------------------------------------
using
ControlLicenseService LicenseInfoClient lic =new ControlLicenseService LicenseInfoClient();
lic.Initialize("sk26901CODA904O",10300);
if (lic.IsSuccess )
{
MessageBox.Show("Success");
}
else
MessageBox.Show("Failure");



This is my code in Late binding:
------------------------------------

Assembly asm = null;
Type PublishType = null;


try
{
string strPath = GetInstalledPath();
asm = Assembly.LoadFrom ("c:\\somefile.dll");
PublishType = asm.GetType("ControlLicenseService.LicenseInfoClient");
Object theObj = Activator.CreateInstance(PublishType);


// Array with Two members for passing the Parameter for Initialize method.
Type[] paramTypes = new Type[2];
paramTypes[0]= Type.GetType("System.String");
paramTypes[1]= Type.GetType("System.Int32");

// Get method info for Initialize( )
MethodInfo InitializeInfo =
PublishType.GetMethod("Initialize",paramTypes);
// Fill the array with the actual parameters
Object[] parameters = new Object[2];
parameters[0] = "sk26901CODA904O";
parameters[1] = 10300;
InitializeInfo.Invoke(theObj,parameters);
PropertyInfo pi = PublishType.GetProperty("IsSuccess");
string valu = pi.GetValue(theObj,null).ToString();
MessageBox.Show(valu);

}





Does there are any exceptions in reflections? What I found thru debugging was the parameters are setting properly n the late binding but the method is not invoked properly or it fails in the method.

Any idea ? or is the code wrong?
Generalcan't associate file ext with app in explorer Pin
Tim Green JIT26-Dec-04 17:11
Tim Green JIT26-Dec-04 17:11 
Generalsimulating a routing algorithm Pin
Aws_Attar26-Dec-04 12:22
Aws_Attar26-Dec-04 12:22 
GeneralRe: simulating a routing algorithm Pin
DavidNohejl26-Dec-04 12:41
DavidNohejl26-Dec-04 12:41 
GeneralRe: simulating a routing algorithm Pin
Aws_Attar26-Dec-04 12:54
Aws_Attar26-Dec-04 12:54 
GeneralAdding those linkbutton under the property window to ur user control Pin
Marlun26-Dec-04 11:03
Marlun26-Dec-04 11:03 
GeneralRe: Unable to comile Spart Parser C# in .NET Pin
Dennis C. Dietrich26-Dec-04 7:38
Dennis C. Dietrich26-Dec-04 7:38 
GeneralRe: Unable to comile Spart Parser C# in .NET Pin
odsby26-Dec-04 10:56
odsby26-Dec-04 10:56 
QuestionJoystick control? Pin
TyronX26-Dec-04 0:38
TyronX26-Dec-04 0:38 
AnswerRe: Joystick control? Pin
Pyro Joe26-Dec-04 4:54
Pyro Joe26-Dec-04 4:54 
GeneralDetecting Media Insertion Pin
delemur26-Dec-04 0:26
delemur26-Dec-04 0:26 
GeneralRe: Detecting Media Insertion Pin
Dennis C. Dietrich26-Dec-04 7:13
Dennis C. Dietrich26-Dec-04 7:13 
Generalweb service call Pin
ABBASI_RA25-Dec-04 20:31
ABBASI_RA25-Dec-04 20:31 
GeneralwFind a window's x y location and x y size Pin
eggie525-Dec-04 18:37
eggie525-Dec-04 18:37 
GeneralRe: wFind a window's x y location and x y size Pin
Pyro Joe26-Dec-04 5:14
Pyro Joe26-Dec-04 5:14 
GeneralRe: wFind a window's x y location and x y size Pin
eggie526-Dec-04 8:00
eggie526-Dec-04 8:00 
GeneralRe: wFind a window's x y location and x y size Pin
Stefan Troschuetz26-Dec-04 6:10
Stefan Troschuetz26-Dec-04 6:10 
GeneralRe: wFind a window's x y location and x y size Pin
Dennis C. Dietrich26-Dec-04 6:40
Dennis C. Dietrich26-Dec-04 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.