By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,842 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,842 IT Pros & Developers. It's quick & easy.

DEADLINE! Please help!

P: n/a
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
Share this Question
Share on Google+
22 Replies

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
> 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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.