Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help on Error Handling (VFP6)
Message
From
09/11/2004 06:03:59
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Conferences & events
Title:
Help on Error Handling (VFP6)
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00959475
Message ID:
00959475
Views:
53
Hi All,

I am encountering a problem while copying the file. I want to track error. Let me explain it to you in breif.

I want to copy file from "C:\Package\Temp\*.dbf" to "H:\Package\Data" folder. While copying there might be a possibility of network connection loosing or the folder is not present or something like this. I want to track when the copying is now possible and want to display a messagebox and ask the user to retry or cancel. If the user says retry then the copying should happen again.

To test this I have written a small prg as given below
lnI = 1
ON ERROR DO Onerror WITH ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )
Do while .T.
    Do Case
        Case Mod(lnI,2) = 1
             Copy File "C:\Package\Temp\Munir.DBF" To "H:\Package\Data\Munir.DBF"
        Case Mod(lnI,2) = 0
             Copy File "C:\Package\Temp\Munir.DBF" To "H:\Package\Dt\Munir.DBF" 
                   &&Error since dt folder is not prsent
    Endcase
    lnI = lnI + 1
Enddo
*--------------------
OnError.PRG
*--------------------
PARAMETER merror, mess, mess1, mprog, mlineno
lnAnswer = Messagebox(merror,21,"Error)
If lnAnswer = 4 && RETRY
    Retry
Endif
Now when the retry command is fired the control is passed to lnI = lnI + 1 command line but I want to continue copying the file in case Mod(lnI,2) = 0

Can anyone help.

Regards

Munir Solkar
Next
Reply
Map
View

Click here to load this message in the networking platform