Save File screen?

chico1st's Avatar, Join Date: Jun 2007
Go4Expert Member
How do you get one of those screens to pop up which allows you to save a file and navigate around windows folders to do so.

Also how to you get the open a file screen.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You have OpenFileDialog and SaveFileDialog which help you doing that.
chico1st's Avatar, Join Date: Jun 2007
Go4Expert Member
I cannot find any information about how to use this with my VisualBasic 6 (it has no help files), can someone please help.
from what I understand OpenFileDialog returns the entire path of the location that you select.
but my code doesnt seem to do anything.

'This does nothing
FName = OpenFileDialog

'This gives me an error
FName = OpenFileDialog()
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
I though you would be using the .NET but VB 6 there is a control for the same.
munkyeetr's Avatar, Join Date: May 2007
Go4Expert Member
Use the CommonDialog Control.
chico1st's Avatar, Join Date: Jun 2007
Go4Expert Member
Ok when i click cancel in the open file dialogue i want to execute a command. But by using
"on error goto cancel" the code in Cancel wont execute one i have executed the loaded a file once. in fact crazy things start to happen. is there any sort of "On cancel exit sub" or something, this is the outline of my code

Private Sub cmdLoad_Click()

On Error GoTo Cancel
...
Exit Sub

Cancel:
...
Exit Sub

End Sub

thank you for your time
chico1st's Avatar, Join Date: Jun 2007
Go4Expert Member
nevermind i needed to click the "cancel error" box in the properties of the dialogue box. Apparently without that it wont always give an error.