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

Easy way to ask for file and directory paths?

5 REPLIES 5
Reply
Message 1 of 6
namin
391 Views, 5 Replies

Easy way to ask for file and directory paths?

Is there an easy way to ask the user for a directory or file, for saving or opening?

Thanks.
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: namin

With .NET framework (since you ask here), using OpenFile/SaveFileDialog and
FolderBrowserDialog would be very easy.

"namin" wrote in message news:5817613@discussion.autodesk.com...
Is there an easy way to ask the user for a directory or file, for saving or
opening?

Thanks.
Message 3 of 6
jbooth
in reply to: namin

You could also use the Autodesk.AutoCAD.Windows namespace to access the internal open/save dialogs that match the Autocad application's GUI.

The System.Windows.Forms namespace is a lot easier to use though...
Message 4 of 6
mfernandes
in reply to: namin

so to add the control “OpenFileDialog" you drag the control from the tool box to a form "Form1.vb"....correct?

now how do you access the method from a different class "myCommand.vb"

 

example I have a form1.vb that has the control  “OpenFileDialog" named OpenFD.

I then have myCommands,vb where I want to access OpenFD.

how do I do that?

 

        Private Sub getfilename()
            openFD.InitialDirectory = "C:\"
            openFD.Title = "Open a Text File"
            openFD.Filter = "Text Files|*.txt"
            openFD.ShowDialog()
        End Sub

 

Message 5 of 6
fieldguy
in reply to: mfernandes

In mycommands.vb you create an instance of your form - something like this:

 

Friend Shared myForm As New form1

 

Now mycommands can reference the contents of form1 through the instance "myForm", as in myForm.textbox (or whatever form tools you need to access).

 

If you want the form1 tools to run methods in mycommands, the sub routines need to be declared as Public Shared.

 

form1.vb can have something like this:

Private Sub somebutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlescmbFiles.Click

mycommands.processformbuttonclick()

EndSub

 

mycommands should have Public Shared Sub processformbuttonclick()

 

This is a good example - it refers to palettes and containers but containers behaviour is very similar to forms.

http://forums.autodesk.com/autodesk/attachments/autodesk/152/26712/1/CP205-2_Mike_Tuersley.pdf

 

Message 6 of 6
mfernandes
in reply to: fieldguy

thanks.

There is some interesting stuff in the paper by

Mike Tuersley AU2007 that I need to go through

 

thanks again

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