Dear Ladies und Gentleman,
support code 339102577. We want to develop a Visual Studio Project with Visual Basic and CorelX7. With Corel X6 everything is perfect. Same steps and no error. In Corel X7 we receive the Error: “Cannot embed interop type 'CorelDRAW.DIVGApplicationEvents_Event' because the source interface 'VGCore.DIVGApplicationEvents' referenced by its ComEventInterfaceAttribute cannot be found.” I don’t know how to solve this Error. I hope you can help us.
Steps to reproduce:
1) Create a Visual Studio 2012 Projekt Language Visual Basic – „Windows Forms Application“
2) Add a Reverence to “CorelDraw 17.3 Type Library “ and “Corel – Vector Graphics Core 17.3 Type Library”
3) Add following Code Error 1 Cannot embed interop type 'CorelDRAW.DIVGApplicationEvents_Event' because the source interface 'VGCore.DIVGApplicationEvents' referenced by its ComEventInterfaceAttribute cannot be found. C:\Users\winkler\AppData\Local\Temporary Projects\KrausNaimer_CorelX7_WithError\Form1.vb 4 22 KrausNaimer_CorelX7_WithError
First of all, with CorelDRAW X7 you don't need to import COM type libraries anymore. It comes with pre-built assemblies for .NET. Just expand "Assemblies > Extensions" in Reference Manager in Visual Studio. And also all you need to add the reference to is Corel.Interop.VGCore assembly. Once you have your reference set, you can just do this in Visual Basic to connect to CorelDRAW and do something:
Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim app As Corel.Interop.VGCore.Application app = CreateObject("CorelDRAW.Application.17") app.Visible = True Dim doc As Corel.Interop.VGCore.Document = app.CreateDocument() doc.ActiveLayer.CreateRectangle(0, 0, 2, 2) End Sub End Class
Thanks. It works. Just a Little Change. Remove Corel.Interop
Dim app As VGCore.Application
app = CreateObject("CorelDRAW.Application.17")
app.Visible = True