|
-
May 8th, 2007, 01:01 AM
#1
CreateObject
Dear All,
In vb.net we can give like this for getting illustrator application
appRef = CreateObject("Illustrator.Application")
in C#.net what we can give for getting illustrator application
Thanks in Advance
Please mark you thread resolved using the Thread Tools as shown
-
May 8th, 2007, 01:24 AM
#2
Re: CreateObject
I would guess Activator.CreateInstance, although I'm not 100% sure how that behaves with COM components.
-
May 8th, 2007, 05:57 AM
#3
Fanatic Member
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
May 8th, 2007, 10:56 PM
#4
Re: CreateObject
Dear BP,
Thanks for your reply.I got this error when i compiled this code.
I have set reference to Microsoft outlook Library.
Code:
Error 1 'WindowsApplication13.Form1' does not contain a definition for 'outApp'
Please mark you thread resolved using the Thread Tools as shown
-
May 8th, 2007, 11:08 PM
#5
Re: CreateObject
When people post code you should assume that it is an example only and probably cannot be just copied and pasted into your app without some adjustment.
The fact that it's referred to as:means that it is obviously a member variable. Have you declared a member variable with that name?
-
May 8th, 2007, 11:25 PM
#6
New Member
Re: CreateObject
Dear JMC,
I cannot get you. this.outApp is a member variable its ok. but what type it must be declared.
-
May 8th, 2007, 11:58 PM
#7
Re: CreateObject
 Originally Posted by siva_boss2003
Dear JMC,
I cannot get you. this.outApp is a member variable its ok. but what type it must be declared.
What is the point of this whole exercise? To create an instance of the Outlook application. That's what outApp is and should be declared as, exactly as Bombdrop's example code shows:
Code:
Type outLookType = Type.GetTypeFromProgID("Outlook.Application" , false);
Code:
this.outApp = Marshal.GetActiveObject("Outlook.Application") as ol._Application;
Code:
this.outApp = Activator.CreateInstance(outLookType) as ol._Application;
-
May 9th, 2007, 01:10 AM
#8
Re: CreateObject
Note also that Bombdrop would have imported and aliased the namespace that the _Application class (or interface, which ever it is in that silly COM world ) is a member of. That would look like this, if I remember correctly:
C# Code:
using ol = Microsoft.Office.Interop.Outlook;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|