You cannot change the object type by using typecasting. Runtime type is an
immutable object property. If your type implements IConvertible, it might be
converted to various types, but not cast. Casting is a logical operation.
E.g.
return (Control) new ComboBox();
This returns an instance of ComboBox even though it is cast to Control
--
Alex Feinman
---
Visit
http://www.opennetcf.org
"Tomer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> Few questions:
>
> 1.How can I change during run time the type casting I'm performing on an
> object?
>
> for example, something like this:
>
> Type controllerType = Type.GetType("controllerTest");
>
> return (controllerType)controller;
>
> where controller is the type of the base class
> and controllerType changes during runtime.
> controllerTest is the class name of the class the inherits from the base
> class.
>
>
> 2.How can I create a new form which is based on an existing form that I
> have
> created?
>
> for example:
> I have a base form that have two buttons OK and Cancel.
> I want to create a new form that inherits from that form, so that the new
> form will have those two buttons from the start.
>
>
>
> Thanks in advanced!!
>
> Tomer.
>
>