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
ctcoley
NA
6
0
Activator.CreateInstance question
Feb 24 2004 8:17 PM
I have been trying to simulate the functionality I have had in the past using Server.CreateObejct(progid,servername) in vbscript on a classic ASP page. It appears I need to be using the System.Activator class, but I have had problems with type casting. For example: Type myType = Type.GetTypeFromProgID(progid,servername); Lib.Object myObject = (Lib.Object)Activator.CreateInstance(myType); When I execute this code, I receive an invalid cast. If I use the following: Type myType = Type.GetTypeFromProgID(progid,servername); Object myObject = Activator.CreateInstance(myType); I don't receive any invalids, but the functions from the object are not available (i.e.; myObject.DoSomething). I have tried several variations including: Type myType = Type.GetTypeFromProgID(progid,servername); Object myObject = Activator.CreateInstance(myType); Lib.Object myObject2 = (Lib.Object)Marshal.CreateWrapperOfType(myObject,typeof(myObject)); One last bit of info, I have an asp page on the same server with the Server.CreateObject call and it works fine. Thanks for any help, ctcoley
Reply
Answers (
1
)
program with word interops wont work on other machines
Error Sending email with Outlook