Is it possible to use GridView in VBA?

Is it possible to use GridView in VBA?

mucip
Collaborator Collaborator
2,096 Views
10 Replies
Message 1 of 11

Is it possible to use GridView in VBA?

mucip
Collaborator
Collaborator

Hi,

I want to show my values in column and lines. So I need GridView but I could not find it additional controls or in reference?

 

Regards,

Mucip:)

0 Likes
Accepted solutions (1)
2,097 Views
10 Replies
Replies (10)
Message 2 of 11

norman.yuan
Mentor
Mentor

The simple answer is "No", or "Yes", depending on whether you use 84-bit AutoCAD, or still 32-bit AutoCAD (option for pre-AutoCAD2020), but most likely, "No" is the answer: who is still using 32-bit AutoCAD these days? It also depends on if you could find a third party 64-bit activeX GridView control (I bet you probably won't). You basically is stuck with the built-in UI controls.

 

Lack of UI and other component support of 64-bit VBA makes it not worth for developing CAD application that is beyond simple/quick CAD fix/solution. If the solution needs better/complicated UI functionality, or is mission-critical, using VBA at this point of time is not a wise choice. I'd not waste my time/effort on VBA unless the business asks a quick solution and I can get it done in a day, or two at most. If you are developing serious CAD solution, moving on to AutoCAD .NET API development would be the way forward.

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 11

mucip
Collaborator
Collaborator

Dear @norman.yuan ,

I use 64 bit AutoCAD 2018 unfortunatelly.

This is very bad news because normally Iwas programing external exe program with VS Community version. But in this time I decided to use VBA. Unfortunatelly it has been wrong choice as I understand now from your answer... 😞

 

I'm in the begining of the project now. I may switch it to the VS.

 

I asked before to this forum but could not find enaugh good guide to use Visual Studio in Autocad.

If I could find a good guide like here for AutoCAD I never use VBA. 😞

 

Can I find this tutorial like for AutoCad sir?...

 

Regards,

Mucip:)

0 Likes
Message 4 of 11

mucip
Collaborator
Collaborator

Hi again,

I mean creating GUI which is cominicating with AutoCAD in Visual Studio, not writing simple command dll and loading it in the AutoCAD.

 

I want to create GUI program which can control the AutoCAD.

 

Regards,

Mucip:)

0 Likes
Message 5 of 11

norman.yuan
Mentor
Mentor

If I understand you correctly, by GUI, you mean the GUI run inside AutoCAD, not an external app. As I said, because now AutoCAD VBA aer 64-bit, its GUI support is extremely limited (if you knew that Acad VBA almost died in version 2014, and only survived that MS eventually supplied Autodesk 64-bit VBA).

 

So, if you continue on using VBA, no GridView, no listview, no treeview. If you want to build better UI into your application, you need to move away from VBA and learn to use AutoCAD .NET API. You can choose either C# or VB.NET (do not listen to your temptation to choose VB.NET just because its code syntax is much more close to VBA code. Again, it would be another bad choice you would regret soon).

 

Even you may have been fairly familiar with AutoCAD programming with VBA (thus AutoCAD COM API), you would still face quite steep learning curve: you need to be knowledgeable enough on generic MS .NET programming before tackle AutoCAD .NET API.

 

There are many Youtube videos available for AutoCAD .NET programming for beginner, if you search "AutoCAD .NET Programming" in Youtube. 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 6 of 11

mucip
Collaborator
Collaborator

Dear @norman.yuan ,

Thanks for detail information.

I have written  GUI program which is check the part list (BOM) in Inventor assembly and transfer all part and sub-asm information to my ERP which is using PostgreSQL database. And many more things ofcourse. I was creating sketch in Inventor via my exe program and mate them together.

My demand is now from VBA or VB.NET or C#; Connect to active Autocad Session (if there is not any AutoCAD session than will open Autocad and connect it) create some points from the txt file and create some tables on the drawing.

Finally export this table detail informations to PostgreSQL.

Now I can get all my demands from VBA but as you say it's getting complicated day by day and VBA will not satisfy me.

I will continue with C# in VS as you adviced (external app). But I need step by step tutorial like I sent before to save time. Because I lost long time with VBA unfortunatelly. 😞

 

Regards,

Mucip:)

 

0 Likes
Message 7 of 11

mucip
Collaborator
Collaborator

Hi,

I really could not understand why all tutorials begins with this:

  <CommandMethod("AdskGreeting")> _
  Public Sub AdskGreeting()

I don't want to create command and load/run it in Autocad.

 

I need tutorial like this but could not. 😞

 

Regards,

Mucip:)

0 Likes
Message 8 of 11

norman.yuan
Mentor
Mentor

You can download Acad .NET programming labs here(step by step of 9 labs) to get started. 

 

As for <CommandMethod...>, that is how you run your .NET application, just as you do with VBA: if you want to run VBA code, you need to run VBA macro, as if it is a command. So, what is wrong by using command to start your application? .NET API could also provide way to run code automatically, such as: as long as the DLL is loaded, the code can run; or the code can be triggered by certain events... But run a command is just a  most normal/common way to let AutoCAD do something, be it .NET command, or built-in command, or LISP/VBA command/macro.  You'll figure it out why all the tutorial begins with a simple command "Hello World" once you get familiar with .NET API.

 

Once you have gone through the 9 basic labs and think you are ready to jump into a real development task, you can ask questions in .NET forum, be it basic ones, or advanced ones.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 9 of 11

mucip
Collaborator
Collaborator

Hi,

Unfortunatelly tutorial video page asking for Flash player. But Flash player is dead now as you know.

Is there any way to download these CamtasiaRecorder videos?

 

I have created GUI API for Inventor very easily but doing the same thing for AutoCAD is really very harder than Inventor unfortunatelly 😞

 

Regards,

Mucip:)

0 Likes
Message 10 of 11

norman.yuan
Mentor
Mentor
Accepted solution

Well, as I recommended, you should patiently go through the labs. If you want to watch video for quicker learning, simply search Youtube for "AutoCAD .NET API programming", which would give you tons of short or long clips, mostly for beginners.

 

As far as I know, adding GUI to AutoCAD .NET app is very, very similar, or almost the same, to what to do with Inventor.  For Inventor you use its COM API, event the development tool is .NET. However, this would not change the way you add GUI part in the project. In terms of easiness of adding GUI in the Visual Studio project (the GUI being WinForm, or WPF), Inventor, or AutoCAD, they are in the same level.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 11 of 11

mucip
Collaborator
Collaborator

Hi,

Thanks a lot for your kind advice.

I will follow the way as you say.

 

Regards,

Mucip:)

0 Likes