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.
Solved! Go to Solution.
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'.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register