I've been using this code for years, and on the new SDK it now throws an end of statement expected and expression expected error. I'm not sure why this is now an issue whereas it hasn't been or how to resolve it.
<CommandMethod("test")>
Public Sub test()
Dim ps New Autodesk.AutoCAD.Windows.PaletteSet = Nothing
ps = As New Autodesk.AutoCAD.Windows.PaletteSet("_")
Dim dp As dtp = New dtp
ps.Add("_", dp)
ps.Visible = True
End Sub
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
@WPerciful wrote:I've been using this code for years, and on the new SDK it now throws an end of statement expected and expression expected error. I'm not sure why this is now an issue whereas it hasn't been or how to resolve it.
<CommandMethod("test")>
Public Sub test()
Dim ps New Autodesk.AutoCAD.Windows.PaletteSet = Nothing
ps = As New Autodesk.AutoCAD.Windows.PaletteSet("_")
Dim dp As dtp = New dtp
ps.Add("_", dp)
ps.Visible = True
End Sub
I don't see how you could've been using that at all, because the New keyword that I've redded above doesn't belong there. It should be 'As' not 'New'.
The As operator that I've redded on the following line also should not be there.
Correct, I edited the code. I was attempting to resolve this error: namespace autodesk.autocad.windows.paletteset not defined. I've got all of the references in but I get that error.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
Did you have reference set to acmgd.dll in your project?
Norman Yuan
I loaded: AcCoreMDG, AcdbMgd and Acmgd.dll
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
check your .net version involved, as if its set too low, I think the references may not be respected.
Just an idea, though you would be getting tons of errors so....
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
I'm running Visual Studio 2015 and AutoCAD 2018. The only code in the app at the moment is the tool palette comandline routine. I did have to specify CPU which I don't recall having to ever set in the past.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
I would bet something is up with your references, as I never set CPU.
I think for some progs using old com objects I have set to 32 bit, but that was years ago.
I bet when you run that down, you will have your answer.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Sir I think that you're on to something. I will remake the project. Instead of setting the CPU and other options, I'll post them here. Perhaps with community's help we'll get to the bottom of it.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
@WPerciful wrote:Correct, I edited the code. I was attempting to resolve this error: namespace autodesk.autocad.windows.paletteset not defined. I've got all of the references in but I get that error.
Autodesk.AutoCAD.Windows.PaletteSet is not a namespace, it is a class that resides in the Autodesk.AutoCAD.Windows namespace.
You didn't bother to show the Imports declarations, which is most-likely where the error is.
Upgraded to AutoCAD 2018 and VS 2015. 2018 SDK AcCoreMDG, AcdbMgd and Acmgd loaded but throws Autodesk.autocad.windows.paletteset not defined error. Attempted to resolve this by modifying my code which throws end of statement & expression expected because my attempt was a syntax error.
So as stated, you are correct. My effort to resolve my original error failed, but I showed it anyway demonstrate my effort to fix the problem.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
The exact error messages read:
BC3002 Autodesk.AutoCAD.Windows.PaletteSet is not defined
and the Intelisense says
{Namespace} Autodesk.AutoCAD.Windows.PaletteSet is not defined
Imports System.Runtime ' Which intelisense says is unnecssary
Imports Autodesk.AutoCAD.Runtime
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
you fixed it though, right?
Activist_Investor called it correctly I thought.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
No it doesn't work.
Upgraded to AutoCAD 2018 and VS 2015. 2018 SDK AcCoreMDG, AcdbMgd and Acmgd loaded but throws Autodesk.autocad.windows.paletteset not defined error. Attempted to resolve this by modifying my code which throws end of statement & expression expected. Below is my unmodified code.
Imports System.runtime
Imports Autodesk.AutoCAD.Runtime
<CommandMethod("test")>
Public Sub test()
Dim ps New Autodesk.AutoCAD.Windows.PaletteSet = Nothing
ps = As Autodesk.AutoCAD.Windows.PaletteSet("_")
Dim dp As dtp = New dtp ' dtp is user control
ps.Add("_", dp)
ps.Visible = True
End Sub
Source of base code is from Mike Tuersley's AutoDesk University 2007 course on tool palettes. Been using it for years.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
did you set copylocal to false on the acad references?
Also, delete the obj folder, that sometimes gets things back in order.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
@WPerciful wrote:
No it doesn't work.
Upgraded to AutoCAD 2018 and VS 2015. 2018 SDK AcCoreMDG, AcdbMgd and Acmgd loaded but throws Autodesk.autocad.windows.paletteset not defined error. Attempted to resolve this by modifying my code which throws end of statement & expression expected. Below is my unmodified code.
Imports System.runtime
Imports Autodesk.AutoCAD.Runtime
<CommandMethod("test")>
Public Sub test()
Dim ps New Autodesk.AutoCAD.Windows.PaletteSet = Nothing
ps = As Autodesk.AutoCAD.Windows.PaletteSet("_")
Dim dp As dtp = New dtp ' dtp is user control
ps.Add("_", dp)
ps.Visible = True
End Sub
Source of base code is from Mike Tuersley's AutoDesk University 2007 course on tool palettes. Been using it for years.
I strongly doubt that the code as you showed here (in RED!) "being used for year"! It is impossible, because it cannot be compiled as you now experienced.
Activist_Investor has already pointed this out, and why did you not try to correct this obvious syntext error and tried to find other reason in vain?
Norman Yuan
@WPerciful wrote:No it doesn't work.
Upgraded to AutoCAD 2018 and VS 2015. 2018 SDK AcCoreMDG, AcdbMgd and Acmgd loaded but throws Autodesk.autocad.windows.paletteset not defined error. Attempted to resolve this by modifying my code which throws end of statement & expression expected. Below is my unmodified code.
Imports System.runtime
Imports Autodesk.AutoCAD.Runtime
<CommandMethod("test")>
Public Sub test()
Dim ps New Autodesk.AutoCAD.Windows.PaletteSet = Nothing
ps = As Autodesk.AutoCAD.Windows.PaletteSet("_")
Dim dp As dtp = New dtp ' dtp is user control
ps.Add("_", dp)
ps.Visible = True
End Sub
Source of base code is from Mike Tuersley's AutoDesk University 2007 course on tool palettes. Been using it for years.
The very simple and obvious syntax error, which remains in the code you posted in the above quote will result in an 'end of statement' compile error because your code does not compile as it is shown.
In the above code, you didn't correct the syntax errors that I previously pointed out.
@WPerciful wrote:The exact error messages read:
BC3002 Autodesk.AutoCAD.Windows.PaletteSet is not defined
and the Intelisense says
{Namespace} Autodesk.AutoCAD.Windows.PaletteSet is not defined
Imports System.Runtime ' Which intelisense says is unnecssary
Imports Autodesk.AutoCAD.Runtime
Your Imports do not include the required one:
Imports Autodesk.AutoCAD.Windows
You're not following the posts. And you're comments are providing no value.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn
I've added that code and it doesn't resolve the issue. The intelisense says Imports statement is unnecessary.
Wayne Perciful
Design Manager | Occidental Petroleum
Occidental Petroleum
Facebook | Twitter | LinkedIn