|
-
Jun 6th, 2000, 12:49 AM
#1
Thread Starter
Addicted Member
Im trying to open a file in a res file thats
it not there because I want my program to
handle the error with out getting a fatal
error, I want the program to just go on.
Whats Wrong With This CODE?
Code:
Public Sub LoadRndPic(rndnum As Integer)
Dim arrByte() As Byte
Dim IFFN As Integer
Dim strTempPath As String
On Error GoTo ErrorHandler ' Enable error-handling routine.
On Error GoTo 0 ' Turn off error trapping.
On Error Resume Next ' Defer error trapping.
arrByte = LoadResData(rndnum, "Custom")
strTempPath = App.Path & "\Loading.jpg"
IFFN = FreeFile
Open strTempPath For Binary As IFFN
Put #IFFN, , arrByte
Close #IFFN
Form1.Picture1.Picture = LoadPicture(strTempPath)
Kill strTempPath
Exit Sub ' Exit to avoid handler.
ErrorHandler: ' Error-handling routine.
Select Case Err.Number ' Evaluate error number.
Case 326 ' "Res Index not there" error.
Exit Sub
End Select
End Sub
[Edited by Dayo312 on 06-06-2000 at 06:38 PM]
-
Jun 6th, 2000, 03:31 AM
#2
I think it's because you have 3 On Error... statements. How can you go to ErrorHandler and then go to 0? Try erasing 2 of the statements and only keeping the one you need most.
-
Jun 6th, 2000, 04:04 AM
#3
transcendental analytic
Meg, is right, erase the resume next and goto 0, if you want your errorhandler to do it's work.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|