|
-
Apr 14th, 2006, 04:10 AM
#1
Thread Starter
PowerPoster
[RESOLVED] FileCopy
Everything seems to be working but the highlighted part isnt. Please advise. Thanks in advance.
VB Code:
Private Sub cmdBackupRegistrationFile_Click()
10 On Error GoTo cmdBackupRegistrationFile
Dim intRet As Integer
20 intRet = MsgBox("You are about to backup your registration file for" & vbNewLine & _
"Braille Quick Reference Guide (Version: " & App.Major & "." & App.Minor & "." & App.Revision & ")" & vbNewLine & _
"Please click Yes to complete backup or click No to cancel the backup." & vbNewLine & vbNewLine & _
"Make sure that you have a floppy disk in your floppy disk drive before you continue.", vbYesNo + vbQuestion, "Backup Registration Information?")
30 If intRet = vbYes Then
40 FileCopy (App.Path & "\licence.lic"), "A:\licence.lic"
50 MsgBox "File copied to your floppy disk successfully!", vbInformation, "File Copied Successfully!!"
60 Else
'do nothing
70 End If
80 [hl]If Err.Number = 76 Then
90 MsgBox "You do not have a floppy disk in your" & vbNewLine & _
"floppy disk drive!", vbExclamation, "Floppy disk not found."
100 End If[/hl]
110 Exit Sub
cmdBackupRegistrationFile:
120 WriteToErrorLog "BRG"
End Sub
-
Apr 14th, 2006, 04:14 AM
#2
Re: FileCopy
On Error GoTo cmdBackupRegistrationFile
This causes it to skip everything and go straight to the error trap. Therefore your code will never run if there is an error.
-
Apr 14th, 2006, 04:29 AM
#3
Thread Starter
PowerPoster
Re: FileCopy
 Originally Posted by Andrew G
On Error GoTo cmdBackupRegistrationFile
This causes it to skip everything and go straight to the error trap. Therefore your code will never run if there is an error.
ok thanks. didnt see it. the problem is now that i am not getting the message box and if the path is not found (error 76) then the app just closes. any suggestions?
Last edited by BrailleSchool; Apr 14th, 2006 at 04:34 AM.
-
Apr 14th, 2006, 04:31 AM
#4
Re: FileCopy
Leave the on error goto statement in, but move lines 80 to 100 to below the cmdBackupRegistrationFile label.
-
Apr 14th, 2006, 04:35 AM
#5
Re: FileCopy
Is the error number 75 or 76 cause if the error number is wrong then the msgbox won't show.
-
Apr 14th, 2006, 04:36 AM
#6
Thread Starter
PowerPoster
Re: FileCopy
 Originally Posted by Frans C
Leave the on error goto statement in, but move lines 80 to 100 to below the cmdBackupRegistrationFile label.
like this?:
VB Code:
Private Sub cmdBackupRegistrationFile_Click()
10 On Error GoTo cmdBackupRegistrationFile
Dim intRet As Integer
20 intRet = MsgBox("You are about to backup your registration file for" & vbNewLine & _
"Braille Quick Reference Guide (Version: " & App.Major & "." & App.Minor & "." & App.Revision & ")" & vbNewLine & _
"Please click Yes to complete backup or click No to cancel the backup." & vbNewLine & vbNewLine & _
"Make sure that you have a floppy disk in your floppy disk drive before you continue.", vbYesNo + vbQuestion, "Backup Registration Information?")
30 If intRet = vbYes Then
40 FileCopy (App.Path & "\licence.lic"), "A:\licence.lic"
50 MsgBox "File copied to your floppy disk successfully!", vbInformation, "File Copied Successfully!!"
60 Else
'do nothing
70 End If
80 Exit Sub
cmdBackupRegistrationFile:
90 If Err.Number = 76 Then
100 MsgBox "You do not have a floppy disk in your" & vbNewLine & _
"floppy disk drive!", vbExclamation, "Floppy disk not found."
110 End If
120 WriteToErrorLog "BRG024"
End Sub
-
Apr 14th, 2006, 04:41 AM
#7
Thread Starter
PowerPoster
Re: FileCopy
 Originally Posted by Andrew G
Is the error number 75 or 76 cause if the error number is wrong then the msgbox won't show.
76, was a typo in the post, updated it.
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
|