.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VB.Net OpenFolderDialog not present/System.Windows.Forms.dll

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
xpeter88
1138 Views, 2 Replies

VB.Net OpenFolderDialog not present/System.Windows.Forms.dll

Hi,

I am working on one VB code for AutoCAD and needs to open folder dialog to select the path by user.

The main issue is that I did not have delcared "OpenFolderDialog" in my project so I have imported System.Windows.Forms.dll and delcared imports System.Windows.Forms in mycommands.vb above the namespace.

 

The problem is that now I can see OpenFolderDialog and work with that but get following message:

 

'Application' is ambigous, imported from the namespaces or types 'Autodesk.AutoCAD.ApplicationServices, System.Windows.Forms and all the declarations does not work like;

 

Dim acDoc as Document = Application.DocumentManager.MdiActiveDocument etc...

 

If I remove that reference System.Windows.Forms.dll or just import - Impotrs System.Windows.Forms that property OpenFolderDialog is not available again.

 

It seems like these two declarations cannot be in one drawing or at least they have to be a bit modified somehow.

 

I just need to open folder dialog in my code and would like to ask you for your help.

 

Many thanks.

2 REPLIES 2
Message 2 of 3
mzakiralam
in reply to: xpeter88

Hi ,

this is happening because application gets two namespaces to invoke OpenFileDialog. Below 2 name spaces are making confused the application. So when you declare openfiledialog please explicitly mention which namespace you want to use for openfile dialog.

 

System.Windows.Forms.OpenFileDialog
Autodesk.AutoCAD.Windows.OpenFileDialog

 

You can use either 'Dim OFD As New System.Windows.Forms.OpenFileDialog' or 'Dim OFD As New Autodesk.AutoCAD.Windows.OpenFileDialog'.

Message 3 of 3
xpeter88
in reply to: xpeter88

Instead of imports System.Windows.Forms at the top I have used System.Windows.Forms.OpenFolderDialog directly when I needed it.

You helped me.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost