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
Printable View
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
I would guess Activator.CreateInstance, although I'm not 100% sure how that behaves with COM components.
Have a look at the following this shows how i hook up to Outlook in my apps.
Hope this helps!!Code://Make sure outlook is on the machine;
Type outLookType = Type.GetTypeFromProgID("Outlook.Application" , false);
if (outLookType != null) {
//see if outlook open and assign that instance to outApp.
try {
this.outApp = Marshal.GetActiveObject("Outlook.Application") as ol._Application;
} catch {
}
if (this.outApp != null) {
this.CanQuitOutLook = false;
} else {
this.outApp = Activator.CreateInstance(outLookType) as ol._Application;
}//(this.outApp!=null)
:wave: :thumb: :wave:
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'
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?Quote:
this.outApp
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:Quote:
Originally Posted by siva_boss2003
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;
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;