VB.NET-PALETTE USER CONTROL

VB.NET-PALETTE USER CONTROL

cturlington
Collaborator Collaborator
994 Views
3 Replies
Message 1 of 4

VB.NET-PALETTE USER CONTROL

cturlington
Collaborator
Collaborator

Hello,

 

I am using Civil 3D 2016.

 

I have been struggling with Lab4; learning to write VB.NET apps for AutoCAD.

 

Labe 4 is creating a Palette and working with Events.  I was able to get the palette to work but I had to comment-out the User Control statements.  There must be components not mentioned in the LAB4 documentation.  In the Lab4 Complete solution there are several UserControl1 Classes whos complexity appear outside the scope of creating a simple palette.  So I have to ask; what is the User Control supposed to provide?  The statements follow for reference:

 

Imports System.Runtime

Imports Autodesk.AutoCAD.Runtime

Imports Autodesk.AutoCAD.ApplicationServices

Imports Autodesk.AutoCAD.DatabaseServices

Imports Autodesk.AutoCAD.Geometry

Imports Autodesk.AutoCAD.EditorInput

Imports Autodesk.AutoCAD.Windows

Imports System.Windows.Controls

'

Namespace myPalette

Public Class myPalette

Public myPaletteSet As PaletteSet

'Public myPalette As UserControl1

<CommandMethod("Palette")> _

Public Sub palette()

If (myPaletteSet = Nothing) Then

myPaletteSet = New PaletteSet("My First Palette", New Guid("AA501203-A0EA-4A3F-BCD5-01F8D7A5F3F1"))

'myPalette = New UserControl1

'myPaletteSet.Add("My First Palette", myPalette)

End If

myPaletteSet.Visible = True

End Sub

End Class

End Namespace

0 Likes
Accepted solutions (2)
995 Views
3 Replies
Replies (3)
Message 2 of 4

andrewpuller3811
Advisor
Advisor
Accepted solution

In the second paragraph of the Autocad 2016 .Net Training document AutoCAD VB VS_2012 Lab4.docx, it says to "

Open your Lab3 project and add a UserControl. Go to the Project menu and select “Add User Control”. (Or open the Lab4 project that already has the UserForm and the steps for lab).

 

Accept the default name (UserControl1.vb)"

 

This is where the Usercontrol1 comes from.

 

 

 

 



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
0 Likes
Message 3 of 4

cturlington
Collaborator
Collaborator

AndrewPuller38,

 

I just noticed that the lab exercises I am following are older, but the newer version has the language you are describing.  Also in the completed Autodesk solution, the labs are all together; Lab1 thru Lab 3 are included in the solution explorer under Lab4.  Am I supposed to keep all the labes together for proper performance, I have been separating them as individual exercieses, I assumed they can stand alone but perhaps not?

0 Likes
Message 4 of 4

andrewpuller3811
Advisor
Advisor
Accepted solution

You can run them as seperate projects but you will need to complete all the steps of the previous labs to get to the current lab you are working on.

 

For example, you need to work through labs 1, 2 and 3 to get to the starting point for lab 4 if starting from scratch, either that or open the lab4 project provided with the .net training download.

 



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023