Chapter 37. Programming with .NET

IN THIS CHAPTER

  • Understanding .NET and AutoCAD

  • Writing VB.NET code

  • Getting user input

  • Creating dialog boxes

  • Modifying objects

  • Trapping errors

.NET is an application development platform that allows you to create applications using programming languages like Visual Basic.NET (VB.NET) or C#. VB.NET is an evolution of the Visual Basic and Visual Basic for Applications (VBA) programming languages. Unlike VBA, the VB.NET development environment is stand-alone and not part of an application like Microsoft Word or AutoCAD.

Prior to deploying .NET applications, you need to install the .NET Framework on all computers that will run your programs. Fortunately, AutoCAD installs the .NET Framework if it is not already on your computer, because several commands in AutoCAD require the .NET Framework. LAYERS, CUI, and EATTEXT are examples.

Note

AutoCAD LT does not support .NET or VBA. This entire chapter applies to AutoCAD only.

Note

While VBA is still available in AutoCAD 2011, Autodesk no longer supports it and plans to completely remove it from the next release. Autodesk recommends that you migrate your VBA projects to .NET or Visual LISP (unless you know C++ and ObjectARX). If you still need to use your VBA applications, you can download and install the VBA module from www.autodesk.com/vba-download. On the Web site, choose the file for your operating system. After installing the VBA enabler, VBA commands and functions work like they did in previous releases. The reason ...

Get AutoCAD® 2011 & AutoCAD LT® 2011 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.