-
Ok, i'm making a program for a super realistic game called Tribes. I am just making a text box and a button called save. I wanted to know how I can get that button to make a save box come up to ask where you want to save it. I also want to know how I can specify what I want it to save by as a deafult in that little dropdown box. I it will have in the save as file box it will have a .cs file option and an all types option.
How would I be able to do that? What would be the code. I'm 11 so go easy on me.:D
-
Use the common dialog control...
Code:
Private Sub Command1_Click()
commondialog1.showsave
End Sub
Then simply add a filter to get the file types you'd like in it.
-
welll
I did that but I got an error.
-
-
Did you put the CommonDialog on your form?
If you've done that, use this code:
Code:
Private Sub Command2_Click()
'display the commondialog show save
On Error GoTo QuitNow:
CommonDialog1.InitDir = "C:\" 'set dir path
CommonDialog1.CancelError = True 'used in cancel code
CommonDialog1.Filter = "All files(*.*)|*.*" 'filter for all files
'use CommonDialog1.Flags = flag1 (or multi flag - flag1 + flag2) if you want
CommonDialog1.ShowSave
'show files
QuitNow:
Exit Sub
End Sub
Private Sub Command1_Click()
'display the commondialog show open
On Error GoTo QuitNow:
CommonDialog1.InitDir = "C:\" 'set dir path
CommonDialog1.CancelError = True 'used in cancel code
CommonDialog1.Filter = "All files(*.*)|*.*" 'filter for all files
'use CommonDialog1.Flags = flag1 (or multi flag - flag1 + flag2) if you want
CommonDialog1.ShowOpen
'show files
QuitNow:
Exit Sub
End Sub
Need more help? Search "CommonDialog constants" in VB's help file.
Hope that helps.