Author Topic: ACAD 2013 - Visual Studio Express 2010 (VB.net)  (Read 3564 times)

0 Members and 1 Guest are viewing this topic.

Yosso

  • Newt
  • Posts: 36
ACAD 2013 - Visual Studio Express 2010 (VB.net)
« on: December 07, 2013, 11:31:46 PM »
I have been working thru the AutoDesk DevTV presentations and labs for .NET and have run into an error that has me stumped.

http://download.autodesk.com/media/adn/AcadDotNetTraining/DevTV_AutoCAD_NET_Training_Session_4/DevTV_AutoCAD_NET_Training_Session_4.html

Partial quote of the code...
Quote
Public myPaletteSet As New PaletteSet

    Public myPalette As UserControl1

    <CommandMethod("palette")> _
    Public Sub palette()
        If (myPaletteSet = Nothing) Then

An error is being thrown for the bolded line above.

Quote
Error   3   Operator '=' is not defined for types 'Lab4.PaletteSet' and 'Lab4.PaletteSet'

Import statements from lab.

Quote
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports System.Windows
Imports Autodesk.AutoCAD.ApplicationServices.Core

The three Autocad references are loaded, all from the AutoCAD program folder.


acmdg.dll
acdbmdg.dll
accoremgd.dll

Any ideas for the 'noobie'?

Thank you in advance.

Mike

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: ACAD 2013 - Visual Studio Express 2010 (VB.net)
« Reply #1 on: December 08, 2013, 12:46:49 AM »
= is the assignment operator
== is the equality test operator

try something like
Code - vb.net: [Select]
  1.  If (myPaletteSet == Nothing) Then
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: ACAD 2013 - Visual Studio Express 2010 (VB.net)
« Reply #2 on: December 08, 2013, 03:00:57 AM »
Hi,

Kerry, what you say stands for C#, it's not the same with VB (which is much more verbose  :evil:).

In VB,
= is the assignment operator and also the equality operator for value types (numbers, strings, structures).
<> is the inequality operator for value types
Is is the equality operator for reference types.
IsNot is the inequality operator for reference types.

So it would be :
Code - vb.net: [Select]
  1. If myPaletteSet Is Nothing Then

Speaking English as a French Frog

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: ACAD 2013 - Visual Studio Express 2010 (VB.net)
« Reply #3 on: December 08, 2013, 04:10:47 AM »
Thanks gile.
all I can say is that my brain locks up when I see VB code. ... my bad !

and thinking about it, assigning Nothing to an object would probably not cause an error ..
« Last Edit: December 08, 2013, 04:14:01 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Yosso

  • Newt
  • Posts: 36
Re: ACAD 2013 - Visual Studio Express 2010 (VB.net)
« Reply #4 on: December 08, 2013, 02:23:18 PM »
I appreciate all of the help and the "is" corrected the equal error (which is odd, as the person doing the presentation used "=" in his vb.net code w/o any errors).

There was another error message that also has me stumped (doesn't take much these days).

Quote
Type 'PaletteSet' is not defined

for the code:

Public myPaletteSet As New PaletteSet


Figured out my last error...always easier to see your mistakes after a good nights rest.

I left off the Autodesk.AutCAD.Windows namespace.  After it was added all is well (relatively speaking).



« Last Edit: December 08, 2013, 02:40:47 PM by Yosso »

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: ACAD 2013 - Visual Studio Express 2010 (VB.net)
« Reply #5 on: December 09, 2013, 10:50:11 AM »
all I can say is that my brain locks up when I see VB code.

+1  :ugly:

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: ACAD 2013 - Visual Studio Express 2010 (VB.net)
« Reply #6 on: December 09, 2013, 01:29:07 PM »
all I can say is that my brain locks up when I see VB code.

+1  :ugly:

+2 :ugly:
Revit 2019, AMEP 2019 64bit Win 10