late binding

  • Thread starter Thread starter Roel
  • Start date Start date
R

Roel

Hello

I try to create an object with late binding. I must create an A object or a
B object. That depends on what the user choses in the GUI. Here you can see
how I try to do it but it will not work. Does anybody knows how to program
this structure ??

Many thx !!

object myObject;

if (String.Equals(RadioButtonList1.SelectedItem.Value,"ADT"))

{

myObject = new A();

}

else

{

myObject = new B();

}
 
Off course after the instantion of myObject I try to execute methods
(myObject.SetParameterValue)

The error I get is the following: 'object' does not contain a definition for
'SetParameterValue'
 
indeed object does not contain that definition. if possible, you should use the base class, orinterface approach to solve your problem. otherwise, you'd have to use reflection to make late-bound calls

----- Roel wrote: ----

Off course after the instantion of myObject I try to execute method
(myObject.SetParameterValue

The error I get is the following: 'object' does not contain a definition fo
'SetParameterValue


Sijin Joseph said:
What happens when you run this code
-Sijin Josep
http://weblogs.asp.net/sjosep
 
Back
Top