TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
CharlieJames
NA
1
0
problem casting from Control to Custom Control
Apr 11 2005 5:45 PM
Plse help. I have a Custom Control (lets call it myCustomControl) which I dynamically load using Assembly.LoadFrom(). I can then instantiate Control objects using "aControl = (Control)AssemblyInstanceName.CreateInstance(classname)" (where AssemblyInstanceName is the name of an instance of the Assembly class) which uses the Assembly classes CreateInstance method and casts the result to a Control object. This seems to work fine, the web form shows my Custom Controls appearing. I do not appear to able to do "myCustomClassInstance = (myCustomClass)AssemblyInstanceName.CreateInstance(classname)" which I think should create the instance as a true myCustomClass. Also I can't then cast the createdinstances from Control to myCustomControl - I keep getting "invalid cast" exceptions. Can anyone please explain what I'm doing wrong? Thanks Charlie
Reply
Answers (
0
)
text to colums + C#
Printing Word Document