AutoCAD 2012, VS2010 Express, NET 3.5
Anyone have an idea of why after using the clipboard in the program,
autocad locks up as soon as I try to open a different drawing and displays the message:
"Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt”
The program works fine, multiple times, copying & pasting (using cntrl + V), until I try to open another drawing in SDI=1.
As soon as I rem out the clipboard line, all is well.
Do I need to dispose of something or clear the clipboard?
private void button2_Click(object sender, EventArgs e)
{
try
{
pictureBox1.Image = null;
pictureBox1.Image = DrawPartInPicBox.PartImage(pictureBox1.Width, pictureBox1.Height); //creates bitmap image
pictureBox1.Update();
//Clipboard.SetImage(pictureBox1.Image); <------ this line is the culprit.
}
catch (Exception exc)
{
MessageBox.Show("Error : " + exc.InnerException);
}
}
TIA!
Bill