.Net problem - totally stuck
I am just starting to play around with using vb.net with AutoCAD 2009. I have experience using VBA and Lisp so I'm not a total noob, but i'm totally stuck nonetheless.I'm running AutoCAD 2009 on 32bit Vista and am programming using vb.Net express 2008.
I downloaded the code for "introduction to .net programming" and am trying to get one of the sample commands to work as I go through the tutorial. http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627
Here's the code I have: (copied straight from the sample code)
' declare a paletteset object, this will only be created oncePublic myPaletteSet As Autodesk.AutoCAD.Windows.PaletteSet' we need a palette which will be housed by the paletteSetPublic myPalette As UserControl1' palette command _PublicSub palette()' check to see if it is validIf (myPaletteSet = Nothing) Then' create a new palette set, with a unique guidmyPaletteSet = New PaletteSet("My Palette", New Guid("D61D0875-A507-4b73-8B5F-9266BEACD596"))' now create a palette inside, this has our tree controlmyPalette = New UserControl1' now add the palette to the palettesetmyPaletteSet.Add("Palette1", myPalette)EndIf' now display the palettesetmyPaletteSet.Visible = TrueEndSub
So the code would work, I created a usercontrol with a treeview on it, and nothing else. It is named usercontrol1.
The code is erroring out at the line:
myPaletteSet.Add("Palette1", myPalette)
I am getting the following error returned to me:
"Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
and a snippet from the exception detail:
"System.Security.SecurityException was unhandled by user code"
Any ideas from the more experienced programmers out there? After some digging around I found out that the problem is that the .dll I was loading was on a network drive and this was causing some sort of permission issue with .net when loading a palette.
Once I moved the .dll onto my local drive everything seemed to work just fine.
If any of you have additional insite on this, let me know.
Thanks,
Joe
页:
[1]