UPDATE:
Never mind. I'd delete this, but haven't figured out how yet.
By playing with the code a little longer I finally discovered what was wrong. I was reading the first part of the path (the root - up to "...Puzzles/" from a text file. It turns out I inadvertently added a CRLF to the end of that file, which is what was screwing everything up.
Sorry. And thanks anyway.
ORIGINAL:
I am trying to read a jpg file from the (external SD Card). I created the directories and put the file on the device myself. My file management system on the device shows the path to the file as:
/mnt/extSdCard/LitSts/Puzzles/1/1 and with the file as
/mnt/extSdCard/LitSts/Puzzles/1/1/0.jpg
To read the file I've stored the path with a final "/" into a string variable, PzlPath and the actual file name into another string variable, FileN. Then I give the code:
Panel.SetBackgroundImage(LoadBitmap(PzlPath, FileN)
I get a FileNotFoundException error message.
However, when I test for the directory (File.IsDirectory), it returns True.
When I test for the file (File.Exists), it returns False. I've tried everything I can think of to find and read the file but without success. The actual code (without the line creating the content of PzlPath is this:
Sub SetPics(P As String) 'P is the path to the puzzle files. Use the files in this path to load as panel background images.
Dim Msg As String 'message
Dim Idx As Int 'Index for the tiles.
Dim FileN As String 'The file to load include the path as prefix.
FileN = "1"
PzlPath = "/mnt/extSdCard/LitSts/Puzzles/1"
Msg = PzlPath & "/" & FileN
If File.IsDirectory(PzlPath, FileN) Then
Msg = Msg & " is Dir."
Else
Msg = Msg & " is NOT Dir."
End If
Msgbox(Msg, "Dir?")
' Activity.Finish
For Idx = 0 To MxCnt
FileN = Idx & ".jpg"
Log("full path = " & PzlPath & FileN)
Log(" ")
Tiles(Idx).SetBackgroundImage(LoadBitmap(PzlPath, FileN))
Next
End Sub
The variable Tiles is an array of panels. The File Not Found errors occurs in the line above "Next".
What am I doing wrong or missing here? Thanks.