[Mono-dev] UserControl type cast issue

Slava Petrenko slava at z.org.ua
Mon Mar 13 16:50:24 EST 2006


Hi all,

I have such a piece of code:

class MyControl : UserControl
{
   .........
}


class MyPage : Page
{
    private void Page_Load(...)
    {
       MyControl control = ( MyControl ) LoadControl( "mycontrol.ascx" );
    }
}


At line MyControl control = ( MyControl ) LoadControl( "mycontrol.ascx" );

I get an error "Cannot cast from source type to destination type"
I refered to MSDN - such a conversion is correct (they got a simulair
sample to the code above), any suggestion?


Slava.



More information about the Mono-devel-list mailing list