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?
[Edited by Dayo312 on 06-06-2000 at 06:38 PM]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




Reply With Quote