|
-
Nov 16th, 1999, 02:54 AM
#1
Thread Starter
Hyperactive Member
Hi,
I'm having trouble with the Save Box on the CommonDialog. Sure, when I enter a file name and press ok the file is saved and Everything is fine, but when I press cancel I get an invalid filename error. What is up???
-
Nov 16th, 1999, 03:14 AM
#2
PowerPoster
rino...This may or may not be it,, but have you tried turning off the CancelError property of the CommonDialog?
Just a thought.
- Chris
-
Nov 16th, 1999, 03:19 AM
#3
Fanatic Member
Try something like this: (put this code right after CommonDialog1.ShowOpen Command)
If Err <> 32755 Then and put everything you want to do when user did not press Cancel. It won't do anything when user will press Cancel.
------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.
[This message has been edited by QWERTY (edited 11-16-1999).]
-
Nov 16th, 1999, 04:11 AM
#4
Thread Starter
Hyperactive Member
could you give me an exact statment please???
-
Nov 16th, 1999, 05:57 AM
#5
Fanatic Member
do something like this:
Code:
Private Sub Command1_Click()
CommonDialog1.ShowOpen
If Err<>32755 Then
FileToOpen=CommonDialog1.FileName
Else
MsgBox "Cancel Was Pressed"
End If
End Sub
This Should Work
------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.
-
Nov 16th, 1999, 08:04 AM
#6
Addicted Member
you could aslo try to do somthing like this:
though I haven't tried it yet.
Private Sub cmdSave_Click()
Dim sFile As String
On Error GoTo NoFile
With cdbLoadSave
.DialogTitle = "save your file"
.Filter = "File(.file)|*.file"
.DefaultExt = ".file"
.CancelError = True
.ShowSave
sFile = .filename
End With
NoFile:
End Sub
name the command button cmdSave and the commondialog cdbLoadSave
hope this helps.
-Lumin
-
Nov 16th, 1999, 08:12 AM
#7
Addicted Member
hi again...
if my example is not working you can use the
example that is displayed on the topic below named COMMONDIALOG
-Lumin
-
Nov 16th, 1999, 08:38 AM
#8
Registered User
Couldn't u just use this to make it work:
Commondailog1.Cancelerror = true
On Error GoTo DoNothing
. . .
. . .
DoNothing:
If Err.Number = cdlCANCEL Then
; do nothing, Cancel button clicked
Else
Msgbox Err.Description
End if
ENd sub
that always works fine for me
-
Nov 16th, 1999, 06:47 PM
#9
Addicted Member
yeah probably.. but now you are making thing just easy : )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|