Active Contributor
Posts: 42
Registered: ‎11-14-2013
Message 1 of 3 (307 Views)
Accepted Solution

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

307 Views, 2 Replies
01-31-2014 04:41 AM


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.

Posts: 229
Registered: ‎11-09-2012
Message 2 of 3 (294 Views)

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

01-31-2014 06:00 AM 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.




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

Active Contributor
Posts: 42
Registered: ‎11-14-2013
Message 3 of 3 (281 Views)

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

01-31-2014 07:04 AM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community