VB Code:
Private Function DoesExist(ByVal strName As String) As Boolean
On Error GoTo Errorhandler ' goto error handler if file doesn't exist
Dim sFile As Long
sFile = FreeFile() 'get a free file #
Open strName For Input As sFile
Close sFile
DoesExist = True 'return if file was opened
Exit Function
Errorhandler:
DoesExist = False 'return false if error occured - meaning file was NOT found
End Function
VB Code:
Private Function SaveSixPack2()
If DoesExist("C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & ".bmp") = False Then
SavePicture Picture13.Picture, ("C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & ".bmp")
End If
If DoesExist("C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & ".bmp") = False Then
Exit Function
Else
SavePicture Picture13.Picture, ("C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & "(" & "1" & ")" & ".bmp")
End If
If DoesExist("C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & "(" & "1" & ")" & ".bmp" & "C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & ".bmp") = False Then
Exit Function
Else
SavePicture Picture13.Picture, ("C:\SixPackImages\" & Generator.lblSixCR.Caption & "-" & "SixPack" & "(" & "2" & ")" & ".bmp")
End If
End Function