Kit_Kat111
asked on
FileNotFoundException was unhandled - HELP! file does exist.
Don't know why I am getting this error:
FileNotFoundException was unhandled
Private Sub cmbTime_SelectedIndexChang ed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChang ed
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" & DateTime.ParseExact(cmbDat e.Selected Item.ToStr ing, "MMMM d, yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
For i As Integer = 1 To 8
Dim pcb As PictureBox = ApplicationControls.FindCo ntrol(Me, "pcbCam" & i)
If Not pcb Is Nothing Then
pcb.Image = Image.FromFile(String.Form at(folder, i)) <<<<<<<<<<
End If
Next i
End Sub
FileNotFoundException was unhandled
Private Sub cmbTime_SelectedIndexChang
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" & DateTime.ParseExact(cmbDat
For i As Integer = 1 To 8
Dim pcb As PictureBox = ApplicationControls.FindCo
If Not pcb Is Nothing Then
pcb.Image = Image.FromFile(String.Form
End If
Next i
End Sub
Yes, you need to look at the value of 'folder'.
My guess is that you have an extra space here: Cam {0}. Should it be Cam{0}?
Bob
My guess is that you have an extra space here: Cam {0}. Should it be Cam{0}?
Bob
ASKER
Thanks Carl and Bob!
C:\Projects\Darryl\Queue Review Files\2-24\Cam 2\Cam1-20060224165653-01.j pg
Nope the test one I put in each folder came up, which was named cam1, but another file that is in each folder doesn't come up. See the jpg name of the file path that had an error, it says Cam1 when it is in the Cam2 folder. :(
C:\Projects\Darryl\Queue Review Files\2-24\Cam 2\Cam1-20060224165653-01.j
Nope the test one I put in each folder came up, which was named cam1, but another file that is in each folder doesn't come up. See the jpg name of the file path that had an error, it says Cam1 when it is in the Cam2 folder. :(
The file name in your sample comes from cmbTime.Text, so that must be where the incorrect Cam1 in the file name is coming from.
Hi Buddy,
ok.. lets see.... looks like you are not getting the right value from cmbTime selection. Try cmbTime.SelectedItem.ToStr ing
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" & DateTime.ParseExact(cmbDat e.Selected Item.ToStr ing, "MMMM d, yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.SelectedItem.ToStr ing
-Baan
ok.. lets see.... looks like you are not getting the right value from cmbTime selection. Try cmbTime.SelectedItem.ToStr
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" & DateTime.ParseExact(cmbDat
-Baan
ASKER
It is so nice to see you!!
I am still getting that error: FileNotFoundException
C:\Projects\Darryl\Queue Review Files\2-24\Cam 2\Cam1-20060224170000-01.j pg
What i need is
C:\Projects\Darryl\Queue Review Files\2-24\Cam 2\Cam2-20060224170000-01.j pg
Do you have rain today? It is cold here...brrr
I am still getting that error: FileNotFoundException
C:\Projects\Darryl\Queue Review Files\2-24\Cam 2\Cam1-20060224170000-01.j
What i need is
C:\Projects\Darryl\Queue Review Files\2-24\Cam 2\Cam2-20060224170000-01.j
Do you have rain today? It is cold here...brrr
ASKER
AH!! I think I know what it is...
Perhaps the combo box is keeping that file.
Okay.
1. User selects from combobox Date "February 24, 2006" which equals the 2-24
folder.
2. This populates another combo box with files from the default folder,
Cam1, so there will be tons of
Cam1-20060224165648-01.jpg
Cam1-20060224165649-01.jpg
Cam1-20060224165650-01.jpg
Cam1-20060224165651-01.jpg
and so on.
So...I need to take that off, a split or something?
take that off and add what the appropiate folder is like Cam6.
I see that must be the problem....can you help me fix this?
thanks everyone for all the help.
Thank you for putting up with me.
Perhaps the combo box is keeping that file.
Okay.
1. User selects from combobox Date "February 24, 2006" which equals the 2-24
folder.
2. This populates another combo box with files from the default folder,
Cam1, so there will be tons of
Cam1-20060224165648-01.jpg
Cam1-20060224165649-01.jpg
Cam1-20060224165650-01.jpg
Cam1-20060224165651-01.jpg
and so on.
So...I need to take that off, a split or something?
take that off and add what the appropiate folder is like Cam6.
I see that must be the problem....can you help me fix this?
thanks everyone for all the help.
Thank you for putting up with me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What would the full path for a valid file name look like?
Bob
Bob
ASKER
That is it! That fixed it!!! YEAH thanks so much guys! I am so thrilled....
Thanks for helping me....!
Thanks for helping me....!
The file not found exception suggests that the path to your image is not being formed correctly.