473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DEADLINE! Please help!

I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,
and Cam 8. Well it does that but it also needs to change the file name to
the same folder where the file is being grabbed, BUT it doesn't. I have
tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg")

End If

Next i
Mar 24 '06 #1
22 2126
What does happen...
I do not see the Format specifier to change the file name...

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam
7, and Cam 8. Well it does that but it also needs to change the file name
to the same folder where the file is being grabbed, BUT it doesn't. I have
tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

Mar 24 '06 #2
Thanks Mike for the help!

That snippet changes the file name to: C:\Projects\Darryl\Queue Review
Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg

:(
"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
What does happen...
I do not see the Format specifier to change the file name...

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam
7, and Cam 8. Well it does that but it also needs to change the file name
to the same folder where the file is being grabbed, BUT it doesn't. I have
tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i


Mar 24 '06 #3
So where does the "Cam" prefix in the file name come from.
The code you posted doesn't show it.

"cmbTime.Text" what is this cmbTime object, it sounds like that's where the
bug is.
"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Mike for the help!

That snippet changes the file name to: C:\Projects\Darryl\Queue Review
Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg

:(
"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
What does happen...
I do not see the Format specifier to change the file name...

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam
7, and Cam 8. Well it does that but it also needs to change the file name
to the same folder where the file is being grabbed, BUT it doesn't. I
have tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i



Mar 24 '06 #4

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam
7, and Cam 8. Well it does that but it also needs to change the file name
to the same folder where the file is being grabbed, BUT it doesn't. I have
tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!


It would help if you gave a clearer and concrete example, like

From ===> To

C:\Projects\Darryl\Queue Review Files\2-24\Cam7\01.jpg ===>
C:\Projects\Darryl\Queue Review Files\2-24\Cam7\Cam7-20060224170000-01.jpg

and explained where the parts of Cam7-20060224170000-01 come from, like

Cam7 is the folder

20060224170000 is the date and ???

01 is the image name -- or whatever.

Mar 24 '06 #5
KitKat,

I adviced you to make your procedure more maintainable and showable to
replace that complete datetime stuff by just an array created by a string
split, you ignored that any reason?

Cor

"KitKat" <ki****@nospam.com> schreef in bericht
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam
7, and Cam 8. Well it does that but it also needs to change the file name
to the same folder where the file is being grabbed, BUT it doesn't. I have
tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

Mar 24 '06 #6
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will only
look for files with Cam1 in the file name, not Cam2, Cam4, Cam6, Cam7 or
Cam8.. I will post more of my code thanks for helping. I appreciate it very
much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files", MessageBoxButtons.OK,
MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out and
points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
So where does the "Cam" prefix in the file name come from.
The code you posted doesn't show it.

"cmbTime.Text" what is this cmbTime object, it sounds like that's where
the bug is.
"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Mike for the help!

That snippet changes the file name to: C:\Projects\Darryl\Queue Review
Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg

:(
"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
What does happen...
I do not see the Format specifier to change the file name...

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6,
Cam 7, and Cam 8. Well it does that but it also needs to change the file
name to the same folder where the file is being grabbed, BUT it doesn't.
I have tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i



Mar 24 '06 #7
The reason anyone not really able to help you is that you are not giving us
the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last part
of the filename. What is the value you are getting from that control?

When you have the answers to these questions, come back and we might be able
to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will only
look for files with Cam1 in the file name, not Cam2, Cam4, Cam6, Cam7 or
Cam8.. I will post more of my code thanks for helping. I appreciate it
very much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files", MessageBoxButtons.OK,
MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out and
points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
So where does the "Cam" prefix in the file name come from.
The code you posted doesn't show it.

"cmbTime.Text" what is this cmbTime object, it sounds like that's where
the bug is.
"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Mike for the help!

That snippet changes the file name to: C:\Projects\Darryl\Queue Review
Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg

:(
"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
What does happen...
I do not see the Format specifier to change the file name...

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6,
>Cam 7, and Cam 8. Well it does that but it also needs to change the
>file name to the same folder where the file is being grabbed, BUT it
>doesn't. I have tried and tried.....please help
>
> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
> 7\Cam7-20060224170000-01.jpg
>
> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
> name,...:( HELP!
>
>
>
> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>
> For i As Integer = 1 To 8
>
> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
> i)
>
> If Not pcb Is Nothing Then
>
> pcb.Image = Image.FromFile(String.Format(folder, i))
>
> 'Else
>
> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>
> End If
>
> Next i
>
>



Mar 24 '06 #8
Sorry I am just learning this stuff. Can you show me what you mean? I have
posted my code below. Thanks for your input.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files", MessageBoxButtons.OK,
MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uz**************@TK2MSFTNGP12.phx.gbl...
KitKat,

I adviced you to make your procedure more maintainable and showable to
replace that complete datetime stuff by just an array created by a string
split, you ignored that any reason?

Cor

"KitKat" <ki****@nospam.com> schreef in bericht
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam
7, and Cam 8. Well it does that but it also needs to change the file name
to the same folder where the file is being grabbed, BUT it doesn't. I have
tried and tried.....please help

example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
7\Cam7-20060224170000-01.jpg

Cam7 but all I keep getting is Cam1, as the beginning of the jpg
name,...:( HELP!

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i))

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i


Mar 24 '06 #9
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not giving
us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will
only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
Cam7 or Cam8.. I will post more of my code thanks for helping. I
appreciate it very much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" & dt.Month
& "-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files", MessageBoxButtons.OK,
MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out and
points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
So where does the "Cam" prefix in the file name come from.
The code you posted doesn't show it.

"cmbTime.Text" what is this cmbTime object, it sounds like that's where
the bug is.
"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Thanks Mike for the help!

That snippet changes the file name to: C:\Projects\Darryl\Queue Review
Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg

:(
"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
> What does happen...
> I do not see the Format specifier to change the file name...
>
> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>
> --
> mike
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6,
>>Cam 7, and Cam 8. Well it does that but it also needs to change the
>>file name to the same folder where the file is being grabbed, BUT it
>>doesn't. I have tried and tried.....please help
>>
>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>> 7\Cam7-20060224170000-01.jpg
>>
>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>> name,...:( HELP!
>>
>>
>>
>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>
>> For i As Integer = 1 To 8
>>
>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>> & i)
>>
>> If Not pcb Is Nothing Then
>>
>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>
>> 'Else
>>
>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>
>> End If
>>
>> Next i
>>
>>
>
>



Mar 24 '06 #10
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you think
are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime actually
have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not giving
us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that
control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will
only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
Cam7 or Cam8.. I will post more of my code thanks for helping. I
appreciate it very much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
yyyy", Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" & dt.Month
& "-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files",
MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out and
points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
So where does the "Cam" prefix in the file name come from.
The code you posted doesn't show it.

"cmbTime.Text" what is this cmbTime object, it sounds like that's where
the bug is.
"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Thanks Mike for the help!
>
> That snippet changes the file name to: C:\Projects\Darryl\Queue Review
> Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>
> :(
>
>
> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
> news:eQ**************@tk2msftngp13.phx.gbl...
>> What does happen...
>> I do not see the Format specifier to change the file name...
>>
>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>
>> --
>> mike
>>
>> "KitKat" <ki****@nospam.com> wrote in message
>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6,
>>>Cam 7, and Cam 8. Well it does that but it also needs to change the
>>>file name to the same folder where the file is being grabbed, BUT it
>>>doesn't. I have tried and tried.....please help
>>>
>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>> 7\Cam7-20060224170000-01.jpg
>>>
>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>> name,...:( HELP!
>>>
>>>
>>>
>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>
>>> For i As Integer = 1 To 8
>>>
>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>>> & i)
>>>
>>> If Not pcb Is Nothing Then
>>>
>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>
>>> 'Else
>>>
>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>
>>> End If
>>>
>>> Next i
>>>
>>>
>>
>>
>
>



Mar 24 '06 #11
I have tried:
'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.SelectedItem.ToString

all basically the same result, the jpg found is not the right name of the
folder.

Thanks for assistance.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not giving
us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that
control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will
only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
Cam7 or Cam8.. I will post more of my code thanks for helping. I
appreciate it very much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
yyyy", Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" & dt.Month
& "-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files",
MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out and
points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
So where does the "Cam" prefix in the file name come from.
The code you posted doesn't show it.

"cmbTime.Text" what is this cmbTime object, it sounds like that's where
the bug is.
"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Thanks Mike for the help!
>
> That snippet changes the file name to: C:\Projects\Darryl\Queue Review
> Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>
> :(
>
>
> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
> news:eQ**************@tk2msftngp13.phx.gbl...
>> What does happen...
>> I do not see the Format specifier to change the file name...
>>
>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>
>> --
>> mike
>>
>> "KitKat" <ki****@nospam.com> wrote in message
>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6,
>>>Cam 7, and Cam 8. Well it does that but it also needs to change the
>>>file name to the same folder where the file is being grabbed, BUT it
>>>doesn't. I have tried and tried.....please help
>>>
>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>> 7\Cam7-20060224170000-01.jpg
>>>
>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>> name,...:( HELP!
>>>
>>>
>>>
>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>
>>> For i As Integer = 1 To 8
>>>
>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>>> & i)
>>>
>>> If Not pcb Is Nothing Then
>>>
>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>
>>> 'Else
>>>
>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>
>>> End If
>>>
>>> Next i
>>>
>>>
>>
>>
>
>



Mar 24 '06 #12
For each of your 8 cams, can you please post the actual name (fully
qualified) of a file that actually exists on you C drive.
"KitKat" <ki****@nospam.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
I have tried:
'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.SelectedItem.ToString

all basically the same result, the jpg found is not the right name of the
folder.

Thanks for assistance.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not giving
us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that
control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will
only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
Cam7 or Cam8.. I will post more of my code thanks for helping. I
appreciate it very much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
yyyy", Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
dt.Month & "-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files",
MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
and points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
> So where does the "Cam" prefix in the file name come from.
> The code you posted doesn't show it.
>
> "cmbTime.Text" what is this cmbTime object, it sounds like that's
> where the bug is.
>
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
>> Thanks Mike for the help!
>>
>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>
>> :(
>>
>>
>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>> news:eQ**************@tk2msftngp13.phx.gbl...
>>> What does happen...
>>> I do not see the Format specifier to change the file name...
>>>
>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>
>>> --
>>> mike
>>>
>>> "KitKat" <ki****@nospam.com> wrote in message
>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>the file name to the same folder where the file is being grabbed,
>>>>BUT it doesn't. I have tried and tried.....please help
>>>>
>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>> 7\Cam7-20060224170000-01.jpg
>>>>
>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>> name,...:( HELP!
>>>>
>>>>
>>>>
>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>
>>>> For i As Integer = 1 To 8
>>>>
>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>> "pcbCam" & i)
>>>>
>>>> If Not pcb Is Nothing Then
>>>>
>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>
>>>> 'Else
>>>>
>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>
>>>> End If
>>>>
>>>> Next i
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #13
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone else
here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you think
are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime actually
have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not giving
us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that
control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
It is part of the jpg file name that won't change not a folder.
"Cam1-33333335649.jpg" my code will look in the right folder but will
only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
Cam7 or Cam8.. I will post more of my code thanks for helping. I
appreciate it very much.

Private Sub cmbDate_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbDate.SelectedIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
yyyy", Nothing)

'loads with the default folder files Cam 1

Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
dt.Month & "-" & dt.Day & "\Cam 1"

Dim dir As New IO.DirectoryInfo(path)

Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")

cmbTime.BeginUpdate()

cmbTime.Items.Clear()

If files.Length > 0 Then

cmbTime.Items.AddRange(files)

End If

cmbTime.EndUpdate()

Catch ex As Exception

MessageBox.Show(ex.Message, "Error Querying Files",
MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try

End Sub

Public Class ApplicationControls

Public Shared Function FindControl(ByVal owner As Form, ByVal name As
String) As Control

Dim propInfo As PropertyInfo = _

owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _

BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public)

If Not propInfo Is Nothing Then

Dim value As Object = propInfo.GetValue(owner, Nothing)

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
and points here

'Else

' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")

End If

Next i

End Sub

"Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
> So where does the "Cam" prefix in the file name come from.
> The code you posted doesn't show it.
>
> "cmbTime.Text" what is this cmbTime object, it sounds like that's
> where the bug is.
>
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
>> Thanks Mike for the help!
>>
>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>
>> :(
>>
>>
>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>> news:eQ**************@tk2msftngp13.phx.gbl...
>>> What does happen...
>>> I do not see the Format specifier to change the file name...
>>>
>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>
>>> --
>>> mike
>>>
>>> "KitKat" <ki****@nospam.com> wrote in message
>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>the file name to the same folder where the file is being grabbed,
>>>>BUT it doesn't. I have tried and tried.....please help
>>>>
>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>> 7\Cam7-20060224170000-01.jpg
>>>>
>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>> name,...:( HELP!
>>>>
>>>>
>>>>
>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>
>>>> For i As Integer = 1 To 8
>>>>
>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>> "pcbCam" & i)
>>>>
>>>> If Not pcb Is Nothing Then
>>>>
>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>
>>>> 'Else
>>>>
>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>
>>>> End If
>>>>
>>>> Next i
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #14
So, you are saying that there is a file named Cam2-20060224165648-01.jpg in
the Cam2 folder and a file named Cam3-20060224165648-01.jpg in the Cam3
folder and a file named Cam4-20060224165648-01.jpg in the Cam4 folder etc.?

Or, is the file in the folder called 20060224165648-01.jpg and you are just
prepending the 'Cam1-' so you know what cam it belongs to?

Does the -01 directly before the extension signify anything? Like the cam
number perhaps?

"KitKat" <ki****@nospam.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone else
here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you
think are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime actually
have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not
giving us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that
control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
> It is part of the jpg file name that won't change not a folder.
> "Cam1-33333335649.jpg" my code will look in the right folder but will
> only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
> Cam7 or Cam8.. I will post more of my code thanks for helping. I
> appreciate it very much.
>
> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> cmbDate.SelectedIndexChanged
>
> Try
>
> Dim dt As DateTime =
> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
> yyyy", Nothing)
>
> 'loads with the default folder files Cam 1
>
> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
> dt.Month & "-" & dt.Day & "\Cam 1"
>
> Dim dir As New IO.DirectoryInfo(path)
>
> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>
> cmbTime.BeginUpdate()
>
> cmbTime.Items.Clear()
>
> If files.Length > 0 Then
>
> cmbTime.Items.AddRange(files)
>
> End If
>
> cmbTime.EndUpdate()
>
> Catch ex As Exception
>
> MessageBox.Show(ex.Message, "Error Querying Files",
> MessageBoxButtons.OK, MessageBoxIcon.Error)
>
> End Try
>
> End Sub
>
>
>
> Public Class ApplicationControls
>
> Public Shared Function FindControl(ByVal owner As Form, ByVal name As
> String) As Control
>
> Dim propInfo As PropertyInfo = _
>
> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>
> BindingFlags.Instance Or BindingFlags.NonPublic Or
> BindingFlags.Public)
>
> If Not propInfo Is Nothing Then
>
> Dim value As Object = propInfo.GetValue(owner, Nothing)
>
> If TypeOf value Is Control Then
>
> Return value
>
> End If
>
> End If
>
> Return Nothing
>
> End Function
>
> End Class
>
>
>
>
>
> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> cmbTime.SelectedIndexChanged
>
> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>
> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>
> For i As Integer = 1 To 8
>
> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
> i)
>
> If Not pcb Is Nothing Then
>
> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
> and points here
>
> 'Else
>
> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>
> End If
>
> Next i
>
> End Sub
>
>
>
> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
> news:Od**************@TK2MSFTNGP12.phx.gbl...
>> So where does the "Cam" prefix in the file name come from.
>> The code you posted doesn't show it.
>>
>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>> where the bug is.
>>
>>
>> "KitKat" <ki****@nospam.com> wrote in message
>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>> Thanks Mike for the help!
>>>
>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>
>>> :(
>>>
>>>
>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>> What does happen...
>>>> I do not see the Format specifier to change the file name...
>>>>
>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>>
>>>> --
>>>> mike
>>>>
>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>>the file name to the same folder where the file is being grabbed,
>>>>>BUT it doesn't. I have tried and tried.....please help
>>>>>
>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>
>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>> name,...:( HELP!
>>>>>
>>>>>
>>>>>
>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>
>>>>> For i As Integer = 1 To 8
>>>>>
>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>> "pcbCam" & i)
>>>>>
>>>>> If Not pcb Is Nothing Then
>>>>>
>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>
>>>>> 'Else
>>>>>
>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>
>>>>> End If
>>>>>
>>>>> Next i
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #15
The one I was using to test was:
Cam1-20060224170000-01.jpg
Cam2-20060224170000-01.jpg
Cam4-20060224170000-01.jpg
Cam6-20060224170000-01.jpg
Cam7-20060224170000-01.jpg
Cam8-20060224170000-01.jpg

sometimes there isn't a picture in that folder but there is of that file.

Thanks again for all your help!

"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For each of your 8 cams, can you please post the actual name (fully
qualified) of a file that actually exists on you C drive.
"KitKat" <ki****@nospam.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
I have tried:
'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.SelectedItem.ToString

all basically the same result, the jpg found is not the right name of the
folder.

Thanks for assistance.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The reason anyone not really able to help you is that you are not
giving us the full information.

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile(String.Format(folder, i))

What is the exception?

What value is String.Format(folder, i) producing?
To find out, try:
Console.Writeline(String.Format(folder, i))
at the appropriate point.

You also have a ComboBox? (cmbTime) from which you are getting the last
part of the filename. What is the value you are getting from that
control?

When you have the answers to these questions, come back and we might be
able to help you.
"KitKat" <ki****@nospam.com> wrote in message
news:OA**************@TK2MSFTNGP10.phx.gbl...
> It is part of the jpg file name that won't change not a folder.
> "Cam1-33333335649.jpg" my code will look in the right folder but will
> only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
> Cam7 or Cam8.. I will post more of my code thanks for helping. I
> appreciate it very much.
>
> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> cmbDate.SelectedIndexChanged
>
> Try
>
> Dim dt As DateTime =
> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
> yyyy", Nothing)
>
> 'loads with the default folder files Cam 1
>
> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
> dt.Month & "-" & dt.Day & "\Cam 1"
>
> Dim dir As New IO.DirectoryInfo(path)
>
> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>
> cmbTime.BeginUpdate()
>
> cmbTime.Items.Clear()
>
> If files.Length > 0 Then
>
> cmbTime.Items.AddRange(files)
>
> End If
>
> cmbTime.EndUpdate()
>
> Catch ex As Exception
>
> MessageBox.Show(ex.Message, "Error Querying Files",
> MessageBoxButtons.OK, MessageBoxIcon.Error)
>
> End Try
>
> End Sub
>
>
>
> Public Class ApplicationControls
>
> Public Shared Function FindControl(ByVal owner As Form, ByVal name As
> String) As Control
>
> Dim propInfo As PropertyInfo = _
>
> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>
> BindingFlags.Instance Or BindingFlags.NonPublic Or
> BindingFlags.Public)
>
> If Not propInfo Is Nothing Then
>
> Dim value As Object = propInfo.GetValue(owner, Nothing)
>
> If TypeOf value Is Control Then
>
> Return value
>
> End If
>
> End If
>
> Return Nothing
>
> End Function
>
> End Class
>
>
>
>
>
> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> cmbTime.SelectedIndexChanged
>
> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>
> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>
> For i As Integer = 1 To 8
>
> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
> i)
>
> If Not pcb Is Nothing Then
>
> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
> and points here
>
> 'Else
>
> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>
> End If
>
> Next i
>
> End Sub
>
>
>
> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
> news:Od**************@TK2MSFTNGP12.phx.gbl...
>> So where does the "Cam" prefix in the file name come from.
>> The code you posted doesn't show it.
>>
>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>> where the bug is.
>>
>>
>> "KitKat" <ki****@nospam.com> wrote in message
>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>> Thanks Mike for the help!
>>>
>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>
>>> :(
>>>
>>>
>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>> What does happen...
>>>> I do not see the Format specifier to change the file name...
>>>>
>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>>
>>>> --
>>>> mike
>>>>
>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>>the file name to the same folder where the file is being grabbed,
>>>>>BUT it doesn't. I have tried and tried.....please help
>>>>>
>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>
>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>> name,...:( HELP!
>>>>>
>>>>>
>>>>>
>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>
>>>>> For i As Integer = 1 To 8
>>>>>
>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>> "pcbCam" & i)
>>>>>
>>>>> If Not pcb Is Nothing Then
>>>>>
>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>
>>>>> 'Else
>>>>>
>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>
>>>>> End If
>>>>>
>>>>> Next i
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #16
That's not the fully qualified file name.

It should look like <drive>:\<folder>\<folder>...\<filename>.<extensio n>
"KitKat" <ki****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
The one I was using to test was:
Cam1-20060224170000-01.jpg
Cam2-20060224170000-01.jpg
Cam4-20060224170000-01.jpg
Cam6-20060224170000-01.jpg
Cam7-20060224170000-01.jpg
Cam8-20060224170000-01.jpg

sometimes there isn't a picture in that folder but there is of that file.

Thanks again for all your help!

"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For each of your 8 cams, can you please post the actual name (fully
qualified) of a file that actually exists on you C drive.
"KitKat" <ki****@nospam.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
I have tried:
'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.SelectedItem.ToString

all basically the same result, the jpg found is not the right name of
the folder.

Thanks for assistance.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> The reason anyone not really able to help you is that you are not
> giving us the full information.
>
> You indicate that an exception occurs at the line:
>
> pcb.Image = Image.FromFile(String.Format(folder, i))
>
> What is the exception?
>
> What value is String.Format(folder, i) producing?
> To find out, try:
> Console.Writeline(String.Format(folder, i))
> at the appropriate point.
>
> You also have a ComboBox? (cmbTime) from which you are getting the
> last part of the filename. What is the value you are getting from that
> control?
>
> When you have the answers to these questions, come back and we might
> be able to help you.
>
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:OA**************@TK2MSFTNGP10.phx.gbl...
>> It is part of the jpg file name that won't change not a folder.
>> "Cam1-33333335649.jpg" my code will look in the right folder but will
>> only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
>> Cam7 or Cam8.. I will post more of my code thanks for helping. I
>> appreciate it very much.
>>
>> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> cmbDate.SelectedIndexChanged
>>
>> Try
>>
>> Dim dt As DateTime =
>> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
>> yyyy", Nothing)
>>
>> 'loads with the default folder files Cam 1
>>
>> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
>> dt.Month & "-" & dt.Day & "\Cam 1"
>>
>> Dim dir As New IO.DirectoryInfo(path)
>>
>> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>>
>> cmbTime.BeginUpdate()
>>
>> cmbTime.Items.Clear()
>>
>> If files.Length > 0 Then
>>
>> cmbTime.Items.AddRange(files)
>>
>> End If
>>
>> cmbTime.EndUpdate()
>>
>> Catch ex As Exception
>>
>> MessageBox.Show(ex.Message, "Error Querying Files",
>> MessageBoxButtons.OK, MessageBoxIcon.Error)
>>
>> End Try
>>
>> End Sub
>>
>>
>>
>> Public Class ApplicationControls
>>
>> Public Shared Function FindControl(ByVal owner As Form, ByVal name As
>> String) As Control
>>
>> Dim propInfo As PropertyInfo = _
>>
>> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>>
>> BindingFlags.Instance Or BindingFlags.NonPublic Or
>> BindingFlags.Public)
>>
>> If Not propInfo Is Nothing Then
>>
>> Dim value As Object = propInfo.GetValue(owner, Nothing)
>>
>> If TypeOf value Is Control Then
>>
>> Return value
>>
>> End If
>>
>> End If
>>
>> Return Nothing
>>
>> End Function
>>
>> End Class
>>
>>
>>
>>
>>
>> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> cmbTime.SelectedIndexChanged
>>
>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>
>> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>
>> For i As Integer = 1 To 8
>>
>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>> & i)
>>
>> If Not pcb Is Nothing Then
>>
>> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
>> and points here
>>
>> 'Else
>>
>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>
>> End If
>>
>> Next i
>>
>> End Sub
>>
>>
>>
>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>> news:Od**************@TK2MSFTNGP12.phx.gbl...
>>> So where does the "Cam" prefix in the file name come from.
>>> The code you posted doesn't show it.
>>>
>>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>>> where the bug is.
>>>
>>>
>>> "KitKat" <ki****@nospam.com> wrote in message
>>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>> Thanks Mike for the help!
>>>>
>>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>>
>>>> :(
>>>>
>>>>
>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>>> What does happen...
>>>>> I do not see the Format specifier to change the file name...
>>>>>
>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>>>
>>>>> --
>>>>> mike
>>>>>
>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>>>the file name to the same folder where the file is being grabbed,
>>>>>>BUT it doesn't. I have tried and tried.....please help
>>>>>>
>>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>>
>>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>>> name,...:( HELP!
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>>
>>>>>> For i As Integer = 1 To 8
>>>>>>
>>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>>> "pcbCam" & i)
>>>>>>
>>>>>> If Not pcb Is Nothing Then
>>>>>>
>>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>>
>>>>>> 'Else
>>>>>>
>>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>>
>>>>>> End If
>>>>>>
>>>>>> Next i
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #17
> So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder Yes there is a file in each folder of that format.

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to? No, I did try that but I am not adding the Cam2- to the file, it already
exists.

Does the -01 directly before the extension signify anything? Like the cam
number perhaps? Good question, no it doesn't signify anything so there is file in each
folder with the -01.jpg.
It is broken up like this:
Cam2- (camera view)
20060224 (date-year, month, day)
165648 (time stamp in military time and with seconds 4:56:48)
-01.jpg (no method applied)

Thank you very much.

"Stephany Young" <noone@localhost> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder and a file named Cam3-20060224165648-01.jpg in the Cam3
folder and a file named Cam4-20060224165648-01.jpg in the Cam4 folder
etc.?

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to?

Does the -01 directly before the extension signify anything? Like the cam
number perhaps?

"KitKat" <ki****@nospam.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone else
here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you
think are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime
actually have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> The reason anyone not really able to help you is that you are not
> giving us the full information.
>
> You indicate that an exception occurs at the line:
>
> pcb.Image = Image.FromFile(String.Format(folder, i))
>
> What is the exception?
>
> What value is String.Format(folder, i) producing?
> To find out, try:
> Console.Writeline(String.Format(folder, i))
> at the appropriate point.
>
> You also have a ComboBox? (cmbTime) from which you are getting the
> last part of the filename. What is the value you are getting from that
> control?
>
> When you have the answers to these questions, come back and we might
> be able to help you.
>
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:OA**************@TK2MSFTNGP10.phx.gbl...
>> It is part of the jpg file name that won't change not a folder.
>> "Cam1-33333335649.jpg" my code will look in the right folder but will
>> only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
>> Cam7 or Cam8.. I will post more of my code thanks for helping. I
>> appreciate it very much.
>>
>> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> cmbDate.SelectedIndexChanged
>>
>> Try
>>
>> Dim dt As DateTime =
>> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
>> yyyy", Nothing)
>>
>> 'loads with the default folder files Cam 1
>>
>> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
>> dt.Month & "-" & dt.Day & "\Cam 1"
>>
>> Dim dir As New IO.DirectoryInfo(path)
>>
>> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>>
>> cmbTime.BeginUpdate()
>>
>> cmbTime.Items.Clear()
>>
>> If files.Length > 0 Then
>>
>> cmbTime.Items.AddRange(files)
>>
>> End If
>>
>> cmbTime.EndUpdate()
>>
>> Catch ex As Exception
>>
>> MessageBox.Show(ex.Message, "Error Querying Files",
>> MessageBoxButtons.OK, MessageBoxIcon.Error)
>>
>> End Try
>>
>> End Sub
>>
>>
>>
>> Public Class ApplicationControls
>>
>> Public Shared Function FindControl(ByVal owner As Form, ByVal name As
>> String) As Control
>>
>> Dim propInfo As PropertyInfo = _
>>
>> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>>
>> BindingFlags.Instance Or BindingFlags.NonPublic Or
>> BindingFlags.Public)
>>
>> If Not propInfo Is Nothing Then
>>
>> Dim value As Object = propInfo.GetValue(owner, Nothing)
>>
>> If TypeOf value Is Control Then
>>
>> Return value
>>
>> End If
>>
>> End If
>>
>> Return Nothing
>>
>> End Function
>>
>> End Class
>>
>>
>>
>>
>>
>> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> cmbTime.SelectedIndexChanged
>>
>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>
>> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>
>> For i As Integer = 1 To 8
>>
>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>> & i)
>>
>> If Not pcb Is Nothing Then
>>
>> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
>> and points here
>>
>> 'Else
>>
>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>
>> End If
>>
>> Next i
>>
>> End Sub
>>
>>
>>
>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>> news:Od**************@TK2MSFTNGP12.phx.gbl...
>>> So where does the "Cam" prefix in the file name come from.
>>> The code you posted doesn't show it.
>>>
>>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>>> where the bug is.
>>>
>>>
>>> "KitKat" <ki****@nospam.com> wrote in message
>>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>> Thanks Mike for the help!
>>>>
>>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>>
>>>> :(
>>>>
>>>>
>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>>> What does happen...
>>>>> I do not see the Format specifier to change the file name...
>>>>>
>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>>>
>>>>> --
>>>>> mike
>>>>>
>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>>>the file name to the same folder where the file is being grabbed,
>>>>>>BUT it doesn't. I have tried and tried.....please help
>>>>>>
>>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>>
>>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>>> name,...:( HELP!
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>>
>>>>>> For i As Integer = 1 To 8
>>>>>>
>>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>>> "pcbCam" & i)
>>>>>>
>>>>>> If Not pcb Is Nothing Then
>>>>>>
>>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>>
>>>>>> 'Else
>>>>>>
>>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>>
>>>>>> End If
>>>>>>
>>>>>> Next i
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #18
Got it working....
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam{0}" &
cmbTime.Text.SubString(cmbTime.Text.IndexOf("-"))

Thanks for helping!
"Stephany Young" <noone@localhost> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder and a file named Cam3-20060224165648-01.jpg in the Cam3
folder and a file named Cam4-20060224165648-01.jpg in the Cam4 folder
etc.?

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to?

Does the -01 directly before the extension signify anything? Like the cam
number perhaps?

"KitKat" <ki****@nospam.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone else
here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you
think are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime
actually have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thanks for helping Stephany.

The exception is: FileNotFoundException was unhandled
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
1-Cam1-20060224165649-01.jpg
cannnot be found, that is because the file is actually:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Darryl\Queue Review Files\2-24\Cam
{0}\Cam1-20060224170000-01.jpg

VALUE: TYPE:
pcb.Image Nothing System. Drawing.Image

From the combo box cmbTime getting the files associated with the date
selected in my combo box cmbDate, which defaults to each Cam 1 folder.
C:\Projects\Darryl\Queue Review Files\2-24\Cam 1

C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\

C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\

is that what you asked? thanks for helping I am really sorry for the
hassle.



"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> The reason anyone not really able to help you is that you are not
> giving us the full information.
>
> You indicate that an exception occurs at the line:
>
> pcb.Image = Image.FromFile(String.Format(folder, i))
>
> What is the exception?
>
> What value is String.Format(folder, i) producing?
> To find out, try:
> Console.Writeline(String.Format(folder, i))
> at the appropriate point.
>
> You also have a ComboBox? (cmbTime) from which you are getting the
> last part of the filename. What is the value you are getting from that
> control?
>
> When you have the answers to these questions, come back and we might
> be able to help you.
>
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:OA**************@TK2MSFTNGP10.phx.gbl...
>> It is part of the jpg file name that won't change not a folder.
>> "Cam1-33333335649.jpg" my code will look in the right folder but will
>> only look for files with Cam1 in the file name, not Cam2, Cam4, Cam6,
>> Cam7 or Cam8.. I will post more of my code thanks for helping. I
>> appreciate it very much.
>>
>> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> cmbDate.SelectedIndexChanged
>>
>> Try
>>
>> Dim dt As DateTime =
>> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
>> yyyy", Nothing)
>>
>> 'loads with the default folder files Cam 1
>>
>> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
>> dt.Month & "-" & dt.Day & "\Cam 1"
>>
>> Dim dir As New IO.DirectoryInfo(path)
>>
>> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>>
>> cmbTime.BeginUpdate()
>>
>> cmbTime.Items.Clear()
>>
>> If files.Length > 0 Then
>>
>> cmbTime.Items.AddRange(files)
>>
>> End If
>>
>> cmbTime.EndUpdate()
>>
>> Catch ex As Exception
>>
>> MessageBox.Show(ex.Message, "Error Querying Files",
>> MessageBoxButtons.OK, MessageBoxIcon.Error)
>>
>> End Try
>>
>> End Sub
>>
>>
>>
>> Public Class ApplicationControls
>>
>> Public Shared Function FindControl(ByVal owner As Form, ByVal name As
>> String) As Control
>>
>> Dim propInfo As PropertyInfo = _
>>
>> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>>
>> BindingFlags.Instance Or BindingFlags.NonPublic Or
>> BindingFlags.Public)
>>
>> If Not propInfo Is Nothing Then
>>
>> Dim value As Object = propInfo.GetValue(owner, Nothing)
>>
>> If TypeOf value Is Control Then
>>
>> Return value
>>
>> End If
>>
>> End If
>>
>> Return Nothing
>>
>> End Function
>>
>> End Class
>>
>>
>>
>>
>>
>> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
>> System.Object, ByVal e As System.EventArgs) Handles
>> cmbTime.SelectedIndexChanged
>>
>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>
>> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>
>> For i As Integer = 1 To 8
>>
>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>> & i)
>>
>> If Not pcb Is Nothing Then
>>
>> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
>> and points here
>>
>> 'Else
>>
>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>
>> End If
>>
>> Next i
>>
>> End Sub
>>
>>
>>
>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>> news:Od**************@TK2MSFTNGP12.phx.gbl...
>>> So where does the "Cam" prefix in the file name come from.
>>> The code you posted doesn't show it.
>>>
>>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>>> where the bug is.
>>>
>>>
>>> "KitKat" <ki****@nospam.com> wrote in message
>>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>> Thanks Mike for the help!
>>>>
>>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>>
>>>> :(
>>>>
>>>>
>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>>> What does happen...
>>>>> I do not see the Format specifier to change the file name...
>>>>>
>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>>>
>>>>> --
>>>>> mike
>>>>>
>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam
>>>>>>6, Cam 7, and Cam 8. Well it does that but it also needs to change
>>>>>>the file name to the same folder where the file is being grabbed,
>>>>>>BUT it doesn't. I have tried and tried.....please help
>>>>>>
>>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>>
>>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>>> name,...:( HELP!
>>>>>>
>>>>>>
>>>>>>
>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>>
>>>>>> For i As Integer = 1 To 8
>>>>>>
>>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>>> "pcbCam" & i)
>>>>>>
>>>>>> If Not pcb Is Nothing Then
>>>>>>
>>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>>
>>>>>> 'Else
>>>>>>
>>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>>
>>>>>> End If
>>>>>>
>>>>>> Next i
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #19
Now we are getting somewhere.

Because you are populating the filename combobox from the Cam1 folder, you
need to replace the "Cam1" in the filename and replace it with the
appropriate value otherwise you will always be looking for a Cam1 file no
matter what folder you are looking in.

Try this.

Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\"

For i As Integer = 1 to 8
Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam" &
i.ToString)
If Not pcb Is Nothing Then
pcb.Image = Image.FromFile(String.Format(folder, i) &
cmdTime.Text.Replace("Cam1-", "Cam" & i.ToString * "-")
End If
Next

Please make sure that you don't just use this and forget about it. It is
important that you dissect and understand the techniques that you are being
presented with, specifically, the usage of the String.Format shared method
and the usage of the String.replace method. It is also important that you
understand why the final part of the filename string must be built inside
the loop instead of being assigned to the folder variable initially.

"KitKat" <ki****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder

Yes there is a file in each folder of that format.

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to?

No, I did try that but I am not adding the Cam2- to the file, it already
exists.

Does the -01 directly before the extension signify anything? Like the cam
number perhaps?

Good question, no it doesn't signify anything so there is file in each
folder with the -01.jpg.
It is broken up like this:
Cam2- (camera view)
20060224 (date-year, month, day)
165648 (time stamp in military time and with seconds 4:56:48)
-01.jpg (no method applied)

Thank you very much.

"Stephany Young" <noone@localhost> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder and a file named Cam3-20060224165648-01.jpg in the
Cam3 folder and a file named Cam4-20060224165648-01.jpg in the Cam4
folder etc.?

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to?

Does the -01 directly before the extension signify anything? Like the cam
number perhaps?

"KitKat" <ki****@nospam.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone else
here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you
think are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime
actually have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Thanks for helping Stephany.
>
> The exception is: FileNotFoundException was unhandled
> C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
> 1-Cam1-20060224165649-01.jpg
> cannnot be found, that is because the file is actually:
> C:\Projects\Darryl\Queue Review Files\2-24\Cam
> 1\Cam1-20060224165649-01.jpg
>
> String.Format is producing:
> FOLDER:
> C:\Projects\Darryl\Queue Review Files\2-24\Cam
> {0}\Cam1-20060224170000-01.jpg
>
> VALUE: TYPE:
> pcb.Image Nothing System. Drawing.Image
>
> From the combo box cmbTime getting the files associated with the date
> selected in my combo box cmbDate, which defaults to each Cam 1
> folder.
> C:\Projects\Darryl\Queue Review Files\2-24\Cam 1
>
> C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\
>
> C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\
>
> is that what you asked? thanks for helping I am really sorry for the
> hassle.
>
>
>
>
>
>
>
>
>
> "Stephany Young" <noone@localhost> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
>> The reason anyone not really able to help you is that you are not
>> giving us the full information.
>>
>> You indicate that an exception occurs at the line:
>>
>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>
>> What is the exception?
>>
>> What value is String.Format(folder, i) producing?
>> To find out, try:
>> Console.Writeline(String.Format(folder, i))
>> at the appropriate point.
>>
>> You also have a ComboBox? (cmbTime) from which you are getting the
>> last part of the filename. What is the value you are getting from
>> that control?
>>
>> When you have the answers to these questions, come back and we might
>> be able to help you.
>>
>>
>> "KitKat" <ki****@nospam.com> wrote in message
>> news:OA**************@TK2MSFTNGP10.phx.gbl...
>>> It is part of the jpg file name that won't change not a folder.
>>> "Cam1-33333335649.jpg" my code will look in the right folder but
>>> will only look for files with Cam1 in the file name, not Cam2, Cam4,
>>> Cam6, Cam7 or Cam8.. I will post more of my code thanks for helping.
>>> I appreciate it very much.
>>>
>>> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
>>> System.Object, ByVal e As System.EventArgs) Handles
>>> cmbDate.SelectedIndexChanged
>>>
>>> Try
>>>
>>> Dim dt As DateTime =
>>> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
>>> yyyy", Nothing)
>>>
>>> 'loads with the default folder files Cam 1
>>>
>>> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> dt.Month & "-" & dt.Day & "\Cam 1"
>>>
>>> Dim dir As New IO.DirectoryInfo(path)
>>>
>>> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>>>
>>> cmbTime.BeginUpdate()
>>>
>>> cmbTime.Items.Clear()
>>>
>>> If files.Length > 0 Then
>>>
>>> cmbTime.Items.AddRange(files)
>>>
>>> End If
>>>
>>> cmbTime.EndUpdate()
>>>
>>> Catch ex As Exception
>>>
>>> MessageBox.Show(ex.Message, "Error Querying Files",
>>> MessageBoxButtons.OK, MessageBoxIcon.Error)
>>>
>>> End Try
>>>
>>> End Sub
>>>
>>>
>>>
>>> Public Class ApplicationControls
>>>
>>> Public Shared Function FindControl(ByVal owner As Form, ByVal name
>>> As String) As Control
>>>
>>> Dim propInfo As PropertyInfo = _
>>>
>>> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>>>
>>> BindingFlags.Instance Or BindingFlags.NonPublic Or
>>> BindingFlags.Public)
>>>
>>> If Not propInfo Is Nothing Then
>>>
>>> Dim value As Object = propInfo.GetValue(owner, Nothing)
>>>
>>> If TypeOf value Is Control Then
>>>
>>> Return value
>>>
>>> End If
>>>
>>> End If
>>>
>>> Return Nothing
>>>
>>> End Function
>>>
>>> End Class
>>>
>>>
>>>
>>>
>>>
>>> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
>>> System.Object, ByVal e As System.EventArgs) Handles
>>> cmbTime.SelectedIndexChanged
>>>
>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>
>>> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>
>>> For i As Integer = 1 To 8
>>>
>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>>> & i)
>>>
>>> If Not pcb Is Nothing Then
>>>
>>> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
>>> and points here
>>>
>>> 'Else
>>>
>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>
>>> End If
>>>
>>> Next i
>>>
>>> End Sub
>>>
>>>
>>>
>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>> news:Od**************@TK2MSFTNGP12.phx.gbl...
>>>> So where does the "Cam" prefix in the file name come from.
>>>> The code you posted doesn't show it.
>>>>
>>>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>>>> where the bug is.
>>>>
>>>>
>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>>> Thanks Mike for the help!
>>>>>
>>>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>>>
>>>>> :(
>>>>>
>>>>>
>>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>>>> What does happen...
>>>>>> I do not see the Format specifier to change the file name...
>>>>>>
>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" &
>>>>>> cmbTime.Text
>>>>>>
>>>>>> --
>>>>>> mike
>>>>>>
>>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4,
>>>>>>>Cam 6, Cam 7, and Cam 8. Well it does that but it also needs to
>>>>>>>change the file name to the same folder where the file is being
>>>>>>>grabbed, BUT it doesn't. I have tried and tried.....please help
>>>>>>>
>>>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>>>
>>>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>>>> name,...:( HELP!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\"
>>>>>>> & DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>>>
>>>>>>> For i As Integer = 1 To 8
>>>>>>>
>>>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>>>> "pcbCam" & i)
>>>>>>>
>>>>>>> If Not pcb Is Nothing Then
>>>>>>>
>>>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>>>
>>>>>>> 'Else
>>>>>>>
>>>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>>>
>>>>>>> End If
>>>>>>>
>>>>>>> Next i
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #20
Yup - that will work quite happily as well.
"KitKat" <ki****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Got it working....
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam{0}" &
cmbTime.Text.SubString(cmbTime.Text.IndexOf("-"))

Thanks for helping!
"Stephany Young" <noone@localhost> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder and a file named Cam3-20060224165648-01.jpg in the
Cam3 folder and a file named Cam4-20060224165648-01.jpg in the Cam4
folder etc.?

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to?

Does the -01 directly before the extension signify anything? Like the cam
number perhaps?

"KitKat" <ki****@nospam.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone else
here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
No....

I think that you are misinterpreting the questions.

You have 2 Comboxes.

One ComboBox (cmbDate) has some values like "2-24" etc.

The other ComboBox (cmbTime) has (I suspect) some filenames that you
think are like "20060224165649-01.jpg" etc.

From what you are reporting I suspect that the values in cmbTime
actually have values more like "Cam1-20060224165649-01.jpg" etc.

Until we know what your exact values are we are shooting in the dark.

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Thanks for helping Stephany.
>
> The exception is: FileNotFoundException was unhandled
> C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
> 1-Cam1-20060224165649-01.jpg
> cannnot be found, that is because the file is actually:
> C:\Projects\Darryl\Queue Review Files\2-24\Cam
> 1\Cam1-20060224165649-01.jpg
>
> String.Format is producing:
> FOLDER:
> C:\Projects\Darryl\Queue Review Files\2-24\Cam
> {0}\Cam1-20060224170000-01.jpg
>
> VALUE: TYPE:
> pcb.Image Nothing System. Drawing.Image
>
> From the combo box cmbTime getting the files associated with the date
> selected in my combo box cmbDate, which defaults to each Cam 1
> folder.
> C:\Projects\Darryl\Queue Review Files\2-24\Cam 1
>
> C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\
>
> C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\
>
> is that what you asked? thanks for helping I am really sorry for the
> hassle.
>
>
>
>
>
>
>
>
>
> "Stephany Young" <noone@localhost> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
>> The reason anyone not really able to help you is that you are not
>> giving us the full information.
>>
>> You indicate that an exception occurs at the line:
>>
>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>
>> What is the exception?
>>
>> What value is String.Format(folder, i) producing?
>> To find out, try:
>> Console.Writeline(String.Format(folder, i))
>> at the appropriate point.
>>
>> You also have a ComboBox? (cmbTime) from which you are getting the
>> last part of the filename. What is the value you are getting from
>> that control?
>>
>> When you have the answers to these questions, come back and we might
>> be able to help you.
>>
>>
>> "KitKat" <ki****@nospam.com> wrote in message
>> news:OA**************@TK2MSFTNGP10.phx.gbl...
>>> It is part of the jpg file name that won't change not a folder.
>>> "Cam1-33333335649.jpg" my code will look in the right folder but
>>> will only look for files with Cam1 in the file name, not Cam2, Cam4,
>>> Cam6, Cam7 or Cam8.. I will post more of my code thanks for helping.
>>> I appreciate it very much.
>>>
>>> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
>>> System.Object, ByVal e As System.EventArgs) Handles
>>> cmbDate.SelectedIndexChanged
>>>
>>> Try
>>>
>>> Dim dt As DateTime =
>>> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
>>> yyyy", Nothing)
>>>
>>> 'loads with the default folder files Cam 1
>>>
>>> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> dt.Month & "-" & dt.Day & "\Cam 1"
>>>
>>> Dim dir As New IO.DirectoryInfo(path)
>>>
>>> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>>>
>>> cmbTime.BeginUpdate()
>>>
>>> cmbTime.Items.Clear()
>>>
>>> If files.Length > 0 Then
>>>
>>> cmbTime.Items.AddRange(files)
>>>
>>> End If
>>>
>>> cmbTime.EndUpdate()
>>>
>>> Catch ex As Exception
>>>
>>> MessageBox.Show(ex.Message, "Error Querying Files",
>>> MessageBoxButtons.OK, MessageBoxIcon.Error)
>>>
>>> End Try
>>>
>>> End Sub
>>>
>>>
>>>
>>> Public Class ApplicationControls
>>>
>>> Public Shared Function FindControl(ByVal owner As Form, ByVal name
>>> As String) As Control
>>>
>>> Dim propInfo As PropertyInfo = _
>>>
>>> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>>>
>>> BindingFlags.Instance Or BindingFlags.NonPublic Or
>>> BindingFlags.Public)
>>>
>>> If Not propInfo Is Nothing Then
>>>
>>> Dim value As Object = propInfo.GetValue(owner, Nothing)
>>>
>>> If TypeOf value Is Control Then
>>>
>>> Return value
>>>
>>> End If
>>>
>>> End If
>>>
>>> Return Nothing
>>>
>>> End Function
>>>
>>> End Class
>>>
>>>
>>>
>>>
>>>
>>> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
>>> System.Object, ByVal e As System.EventArgs) Handles
>>> cmbTime.SelectedIndexChanged
>>>
>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>
>>> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>
>>> For i As Integer = 1 To 8
>>>
>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me, "pcbCam"
>>> & i)
>>>
>>> If Not pcb Is Nothing Then
>>>
>>> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors out
>>> and points here
>>>
>>> 'Else
>>>
>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>
>>> End If
>>>
>>> Next i
>>>
>>> End Sub
>>>
>>>
>>>
>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>> news:Od**************@TK2MSFTNGP12.phx.gbl...
>>>> So where does the "Cam" prefix in the file name come from.
>>>> The code you posted doesn't show it.
>>>>
>>>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>>>> where the bug is.
>>>>
>>>>
>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>>> Thanks Mike for the help!
>>>>>
>>>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>>>
>>>>> :(
>>>>>
>>>>>
>>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>>>> What does happen...
>>>>>> I do not see the Format specifier to change the file name...
>>>>>>
>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" &
>>>>>> cmbTime.Text
>>>>>>
>>>>>> --
>>>>>> mike
>>>>>>
>>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4,
>>>>>>>Cam 6, Cam 7, and Cam 8. Well it does that but it also needs to
>>>>>>>change the file name to the same folder where the file is being
>>>>>>>grabbed, BUT it doesn't. I have tried and tried.....please help
>>>>>>>
>>>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>>>
>>>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the jpg
>>>>>>> name,...:( HELP!
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\"
>>>>>>> & DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>>>
>>>>>>> For i As Integer = 1 To 8
>>>>>>>
>>>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>>>> "pcbCam" & i)
>>>>>>>
>>>>>>> If Not pcb Is Nothing Then
>>>>>>>
>>>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>>>
>>>>>>> 'Else
>>>>>>>
>>>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>>>
>>>>>>> End If
>>>>>>>
>>>>>>> Next i
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #21

"KitKat" <ki****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Sorry I am just learning this stuff. Can you show me what you mean? I have
posted my code below. Thanks for your input.


Your code doesn't help. I need to know what you have and what you want, i.e.
"I have three goats and I need cheese".

In other words, the algorithm not the code.
Mar 24 '06 #22
Thank you very much....it really helped talking to someone.

"Stephany Young" <noone@localhost> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Yup - that will work quite happily as well.
"KitKat" <ki****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Got it working....
Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
Nothing).ToString("M-d") & "\Cam {0}\Cam{0}" &
cmbTime.Text.SubString(cmbTime.Text.IndexOf("-"))

Thanks for helping!
"Stephany Young" <noone@localhost> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
So, you are saying that there is a file named Cam2-20060224165648-01.jpg
in the Cam2 folder and a file named Cam3-20060224165648-01.jpg in the
Cam3 folder and a file named Cam4-20060224165648-01.jpg in the Cam4
folder etc.?

Or, is the file in the folder called 20060224165648-01.jpg and you are
just prepending the 'Cam1-' so you know what cam it belongs to?

Does the -01 directly before the extension signify anything? Like the
cam number perhaps?

"KitKat" <ki****@nospam.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
YES you are right! 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, like previously said, 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 so much Stephany, I appreciate your help as well as everyone
else here.

Thank you for putting up with me.

"Stephany Young" <noone@localhost> wrote in message
news:eP**************@TK2MSFTNGP10.phx.gbl...
> No....
>
> I think that you are misinterpreting the questions.
>
> You have 2 Comboxes.
>
> One ComboBox (cmbDate) has some values like "2-24" etc.
>
> The other ComboBox (cmbTime) has (I suspect) some filenames that you
> think are like "20060224165649-01.jpg" etc.
>
> From what you are reporting I suspect that the values in cmbTime
> actually have values more like "Cam1-20060224165649-01.jpg" etc.
>
> Until we know what your exact values are we are shooting in the dark.
>
>
>
> "KitKat" <ki****@nospam.com> wrote in message
> news:%2****************@TK2MSFTNGP10.phx.gbl...
>> Thanks for helping Stephany.
>>
>> The exception is: FileNotFoundException was unhandled
>> C:\Projects\Darryl\Queue Review Files\2-24\Cam 1\Cam
>> 1-Cam1-20060224165649-01.jpg
>> cannnot be found, that is because the file is actually:
>> C:\Projects\Darryl\Queue Review Files\2-24\Cam
>> 1\Cam1-20060224165649-01.jpg
>>
>> String.Format is producing:
>> FOLDER:
>> C:\Projects\Darryl\Queue Review Files\2-24\Cam
>> {0}\Cam1-20060224170000-01.jpg
>>
>> VALUE: TYPE:
>> pcb.Image Nothing System. Drawing.Image
>>
>> From the combo box cmbTime getting the files associated with the date
>> selected in my combo box cmbDate, which defaults to each Cam 1
>> folder.
>> C:\Projects\Darryl\Queue Review Files\2-24\Cam 1
>>
>> C:\Projects\Darryl\Queue Review Files\2-27\Cam 7\
>>
>> C:\Projects\Darryl\Queue Review Files\2-28\Cam 7\
>>
>> is that what you asked? thanks for helping I am really sorry for the
>> hassle.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> "Stephany Young" <noone@localhost> wrote in message
>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>> The reason anyone not really able to help you is that you are not
>>> giving us the full information.
>>>
>>> You indicate that an exception occurs at the line:
>>>
>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>
>>> What is the exception?
>>>
>>> What value is String.Format(folder, i) producing?
>>> To find out, try:
>>> Console.Writeline(String.Format(folder, i))
>>> at the appropriate point.
>>>
>>> You also have a ComboBox? (cmbTime) from which you are getting the
>>> last part of the filename. What is the value you are getting from
>>> that control?
>>>
>>> When you have the answers to these questions, come back and we might
>>> be able to help you.
>>>
>>>
>>> "KitKat" <ki****@nospam.com> wrote in message
>>> news:OA**************@TK2MSFTNGP10.phx.gbl...
>>>> It is part of the jpg file name that won't change not a folder.
>>>> "Cam1-33333335649.jpg" my code will look in the right folder but
>>>> will only look for files with Cam1 in the file name, not Cam2,
>>>> Cam4, Cam6, Cam7 or Cam8.. I will post more of my code thanks for
>>>> helping. I appreciate it very much.
>>>>
>>>> Private Sub cmbDate_SelectedIndexChanged(ByVal sender As
>>>> System.Object, ByVal e As System.EventArgs) Handles
>>>> cmbDate.SelectedIndexChanged
>>>>
>>>> Try
>>>>
>>>> Dim dt As DateTime =
>>>> DateTime.ParseExact(cmbDate.Items(cmbDate.Selected Index), "MMMM d,
>>>> yyyy", Nothing)
>>>>
>>>> 'loads with the default folder files Cam 1
>>>>
>>>> Dim path As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> dt.Month & "-" & dt.Day & "\Cam 1"
>>>>
>>>> Dim dir As New IO.DirectoryInfo(path)
>>>>
>>>> Dim files As IO.FileInfo() = dir.GetFiles("*.jpg")
>>>>
>>>> cmbTime.BeginUpdate()
>>>>
>>>> cmbTime.Items.Clear()
>>>>
>>>> If files.Length > 0 Then
>>>>
>>>> cmbTime.Items.AddRange(files)
>>>>
>>>> End If
>>>>
>>>> cmbTime.EndUpdate()
>>>>
>>>> Catch ex As Exception
>>>>
>>>> MessageBox.Show(ex.Message, "Error Querying Files",
>>>> MessageBoxButtons.OK, MessageBoxIcon.Error)
>>>>
>>>> End Try
>>>>
>>>> End Sub
>>>>
>>>>
>>>>
>>>> Public Class ApplicationControls
>>>>
>>>> Public Shared Function FindControl(ByVal owner As Form, ByVal name
>>>> As String) As Control
>>>>
>>>> Dim propInfo As PropertyInfo = _
>>>>
>>>> owner.GetType().GetProperty(name, BindingFlags.IgnoreCase Or _
>>>>
>>>> BindingFlags.Instance Or BindingFlags.NonPublic Or
>>>> BindingFlags.Public)
>>>>
>>>> If Not propInfo Is Nothing Then
>>>>
>>>> Dim value As Object = propInfo.GetValue(owner, Nothing)
>>>>
>>>> If TypeOf value Is Control Then
>>>>
>>>> Return value
>>>>
>>>> End If
>>>>
>>>> End If
>>>>
>>>> Return Nothing
>>>>
>>>> End Function
>>>>
>>>> End Class
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Private Sub cmbTime_SelectedIndexChanged(ByVal sender As
>>>> System.Object, ByVal e As System.EventArgs) Handles
>>>> cmbTime.SelectedIndexChanged
>>>>
>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>> Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>>>>
>>>> 'Dim folder As String = "C:\Projects\Darryl\Queue Review Files\" &
>>>> DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d, yyyy",
>>>> Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>
>>>> For i As Integer = 1 To 8
>>>>
>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>> "pcbCam" & i)
>>>>
>>>> If Not pcb Is Nothing Then
>>>>
>>>> pcb.Image = Image.FromFile(String.Format(folder, i)) <<<errors
>>>> out and points here
>>>>
>>>> 'Else
>>>>
>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>
>>>> End If
>>>>
>>>> Next i
>>>>
>>>> End Sub
>>>>
>>>>
>>>>
>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>> news:Od**************@TK2MSFTNGP12.phx.gbl...
>>>>> So where does the "Cam" prefix in the file name come from.
>>>>> The code you posted doesn't show it.
>>>>>
>>>>> "cmbTime.Text" what is this cmbTime object, it sounds like that's
>>>>> where the bug is.
>>>>>
>>>>>
>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>> news:%2****************@TK2MSFTNGP09.phx.gbl...
>>>>>> Thanks Mike for the help!
>>>>>>
>>>>>> That snippet changes the file name to: C:\Projects\Darryl\Queue
>>>>>> Review Files\2-24\Cam 1\Cam 1-Cam1-20060224165649-01.jpg
>>>>>>
>>>>>> :(
>>>>>>
>>>>>>
>>>>>> "Mike Levine" <na*******@REMOVEcomcast.net> wrote in message
>>>>>> news:eQ**************@tk2msftngp13.phx.gbl...
>>>>>>> What does happen...
>>>>>>> I do not see the Format specifier to change the file name...
>>>>>>>
>>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\"
>>>>>>> & DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\Cam {0}-" &
>>>>>>> cmbTime.Text
>>>>>>>
>>>>>>> --
>>>>>>> mike
>>>>>>>
>>>>>>> "KitKat" <ki****@nospam.com> wrote in message
>>>>>>> news:%2******************@TK2MSFTNGP10.phx.gbl...
>>>>>>>>I need to get this to go to each folders: Cam 1, Cam 2, Cam 4,
>>>>>>>>Cam 6, Cam 7, and Cam 8. Well it does that but it also needs to
>>>>>>>>change the file name to the same folder where the file is being
>>>>>>>>grabbed, BUT it doesn't. I have tried and tried.....please help
>>>>>>>>
>>>>>>>> example: C:\Projects\Darryl\Queue Review Files\2-24\Cam
>>>>>>>> 7\Cam7-20060224170000-01.jpg
>>>>>>>>
>>>>>>>> Cam7 but all I keep getting is Cam1, as the beginning of the
>>>>>>>> jpg name,...:( HELP!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Dim folder As String = "C:\Projects\Darryl\Queue Review Files\"
>>>>>>>> & DateTime.ParseExact(cmbDate.SelectedItem.ToString, "MMMM d,
>>>>>>>> yyyy", Nothing).ToString("M-d") & "\Cam {0}\" & cmbTime.Text
>>>>>>>>
>>>>>>>> For i As Integer = 1 To 8
>>>>>>>>
>>>>>>>> Dim pcb As PictureBox = ApplicationControls.FindControl(Me,
>>>>>>>> "pcbCam" & i)
>>>>>>>>
>>>>>>>> If Not pcb Is Nothing Then
>>>>>>>>
>>>>>>>> pcb.Image = Image.FromFile(String.Format(folder, i))
>>>>>>>>
>>>>>>>> 'Else
>>>>>>>>
>>>>>>>> ' pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review
>>>>>>>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>>>>>>>
>>>>>>>> End If
>>>>>>>>
>>>>>>>> Next i
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Mar 24 '06 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hayo Thielecke | last post by:
The deadline for CW'04 has been extended to 15 October. (Authors who have already submitted may resubmit if they like.) --- Hayo Thielecke The Fourth ACM-SIGPLAN Continuations Workshop (CW'04)...
0
by: Guido van Rossum | last post by:
Just a quick reminder: you have another week to submit a proposal for the Python 12 Conference at OSCON: The O'Reilly Open Source Convention (OSCON) will be held July 26-30, 2004 at the Portland...
0
by: Guido van Rossum | last post by:
This is the FINAL reminder: you still have all day today to submit a proposal for the Python 12 Conference at OSCON: The O'Reilly Open Source Convention (OSCON) will be held July 26-30, 2004 at...
0
by: Martijn Faassen | last post by:
EuroPython news update april 30 =============================== EuroPython early bird registration deadline is may 1, next saturday! After that you pay 60 euros more. Some cheap accomodation...
0
by: Steve Holden | last post by:
Pythonistas: If you have been putting off your registration, stop putting it off! Last year the early bird deadline was extended because we were a little late getting the program together....
0
by: asj | last post by:
from the borg lady: http://www.freeroller.net/page/Sayaka/20030819#walmart_deadline_shows_java_cashing ------------------------------------------------- I/We read with interest Walmart's new...
0
by: A.M. Kuchling | last post by:
The deadline for PyCon proposals is now three weeks away; proposals must be received by Oct. 31st. Read the call for proposals for what we're looking for and how to submit:...
0
by: jygoh3 | last post by:
ENCYCLOPEDIA OF MOBILE COMPUTING & COMMERCE CALL FOR SHORT ARTICLES Proposal Deadline: 15 Nov 2005 (Extended)
0
by: GHUM | last post by:
We took longer then planned to open the registration. Some potential speakers came in late. To make it even, we extended talk submission deadline for ONE WEEK. New deadline is Friday, 25th...
0
by: David Goodger | last post by:
If you haven't registered for PyCon yet, now is the time! The early-bird registration deadline is February 20, one week away. After that, the price for registration will be going up. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.