MRU (Most Recently Used) List
Code:
Private Sub mnuFileMRU_Click(index As Integer)
strFileNewName1 = (Left(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "\DAF")) & "Map\")
strFileNewName2 = (Mid(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "MY"), 8) & ".bmp")
strFileNewName3 = strFileNewName1 & strFileNewName2
Picture1.Picture = LoadPicture(strFileNewName3)
Call ConvertMRU
Call ENCExtractMRU
Call setScale
blnOkToMove = True
End Sub
i used the code above and came out an error "path not found" (point to line in red color)when i click the MRU list but when that file not in that directory.
how to add code to above to avoid that kind of error occur and also instead it by a message box to let user know that the file is not find and please try select again.
Re: MRU (Most Recently Used) List
vb Code:
Private Sub mnuFileMRU_Click(index As Integer)
On Error GoTo ErrTrap
strFileNewName1 = (Left(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "\DAF")) & "Map\")
strFileNewName2 = (Mid(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "MY"), 8) & ".bmp")
strFileNewName3 = strFileNewName1 & strFileNewName2
Picture1.Picture = LoadPicture(strFileNewName3)
Call ConvertMRU
Call ENCExtractMRU
Call setScale
blnOkToMove = True
Exit Sub
ErrTrap:
Select Case Err.Number
Case (I don't remember the error number for path not found)
Msgbox "The selected file is not found in that path."
Case Else
Msgbox "An Error has occurred. It is " & Err.Number & " " & Err.Description
End Select
End Sub