I am dabbling in a little drawing automation with Visio 2003. However, I am having a problem taking what MSDN says and incorporating it into my code. I am probably making a very newbie mistake. However, after days of searching the internet I have yet to implement a solution.
I am trying to simply open a stencil from a tbClick. The MSDN site tells me to use DrawingControl.Src to open the stencil. However, when I apply DrawingControl to the code and compile I get this error: An object reference is required for the nonstatic field, method, or property 'VisOcx.IDrawingCopntrol.Src.get'(CS0120). Below is a snippet of code that shows the namespace resources and the function I am trying to implement.
I am open to any and all suggestions about the code as well.
//namespace
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using Visio1 = Microsoft.Office.Interop.Visio;
using Visio2 = VisOcx;
//function
void Qed2_elevation_stencil_tbClick(object sender, EventArgs e)
{
try
{
Visio2.DrawingControl.Src = "C:\\Drawing.vsd";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return;
}