473,554 Members | 3,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DEADLINE! Please help!

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

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

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

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

Next i

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

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

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

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

Next i


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

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

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

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

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

Next i



Mar 24 '06 #4

"KitKat" <ki****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Dar ryl\Queue Review Files\2-24\Cam7\01.jpg ===>
C:\Projects\Dar ryl\Queue Review Files\2-24\Cam7\Cam7-20060224170000-01.jpg

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

Cam7 is the folder

20060224170000 is the date and ???

01 is the image name -- or whatever.

Mar 24 '06 #5
KitKat,

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

Cor

"KitKat" <ki****@nospam. com> schreef in bericht
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

Next i

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

Private Sub cmbDate_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbDate.Selecte dIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseE xact(cmbDate.It ems(cmbDate.Sel ectedIndex), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

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

Dim dir As New IO.DirectoryInf o(path)

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

cmbTime.BeginUp date()

cmbTime.Items.C lear()

If files.Length > 0 Then

cmbTime.Items.A ddRange(files)

End If

cmbTime.EndUpda te()

Catch ex As Exception

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

End Try

End Sub

Public Class ApplicationCont rols

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

Dim propInfo As PropertyInfo = _

owner.GetType() .GetProperty(na me, BindingFlags.Ig noreCase Or _

BindingFlags.In stance Or BindingFlags.No nPublic Or BindingFlags.Pu blic)

If Not propInfo Is Nothing Then

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

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbTime.Selecte dIndexChanged

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

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

'Else

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

End If

Next i

End Sub

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

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

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

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

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" &
i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

Next i



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

You indicate that an exception occurs at the line:

pcb.Image = Image.FromFile( String.Format(f older, i))

What is the exception?

What value is String.Format(f older, i) producing?
To find out, try:
Console.Writeli ne(String.Forma t(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******** ******@TK2MSFTN GP10.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_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbDate.Selecte dIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseE xact(cmbDate.It ems(cmbDate.Sel ectedIndex), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

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

Dim dir As New IO.DirectoryInf o(path)

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

cmbTime.BeginUp date()

cmbTime.Items.C lear()

If files.Length > 0 Then

cmbTime.Items.A ddRange(files)

End If

cmbTime.EndUpda te()

Catch ex As Exception

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

End Try

End Sub

Public Class ApplicationCont rols

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

Dim propInfo As PropertyInfo = _

owner.GetType() .GetProperty(na me, BindingFlags.Ig noreCase Or _

BindingFlags.In stance Or BindingFlags.No nPublic Or BindingFlags.Pu blic)

If Not propInfo Is Nothing Then

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

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbTime.Selecte dIndexChanged

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

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

'Else

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

End If

Next i

End Sub

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

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

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

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

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

--
mike

"KitKat" <ki****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
>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.....pleas e help
>
> example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
> DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
> Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text
>
> For i As Integer = 1 To 8
>
> Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" &
> i)
>
> If Not pcb Is Nothing Then
>
> pcb.Image = Image.FromFile( String.Format(f older, i))
>
> 'Else
>
> ' pcb.Image = Image.FromFile( "C:\Projects\Da rryl\Queue Review
> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>
> End If
>
> Next i
>
>



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

Private Sub cmbDate_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbDate.Selecte dIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseE xact(cmbDate.It ems(cmbDate.Sel ectedIndex), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

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

Dim dir As New IO.DirectoryInf o(path)

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

cmbTime.BeginUp date()

cmbTime.Items.C lear()

If files.Length > 0 Then

cmbTime.Items.A ddRange(files)

End If

cmbTime.EndUpda te()

Catch ex As Exception

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

End Try

End Sub

Public Class ApplicationCont rols

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

Dim propInfo As PropertyInfo = _

owner.GetType() .GetProperty(na me, BindingFlags.Ig noreCase Or _

BindingFlags.In stance Or BindingFlags.No nPublic Or BindingFlags.Pu blic)

If Not propInfo Is Nothing Then

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

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbTime.Selecte dIndexChanged

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

' pcb.Image = Image.FromFile( "C:\Projects\Da rryl\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******** ******@TK2MSFTN GP12.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******** **********@TK2M SFTNGP10.phx.gb l...
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.....pleas e help

example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

pcb.Image = Image.FromFile( String.Format(f older, i))

'Else

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

End If

Next i


Mar 24 '06 #9
Thanks for helping Stephany.

The exception is: FileNotFoundExc eption was unhandled
C:\Projects\Dar ryl\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\Dar ryl\Queue Review Files\2-24\Cam 1\Cam1-20060224165649-01.jpg

String.Format is producing:
FOLDER:
C:\Projects\Dar ryl\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\Dar ryl\Queue Review Files\2-24\Cam 1

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

C:\Projects\Dar ryl\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@localhos t> wrote in message
news:%2******** ********@TK2MSF TNGP09.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(f older, i))

What is the exception?

What value is String.Format(f older, i) producing?
To find out, try:
Console.Writeli ne(String.Forma t(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******** ******@TK2MSFTN GP10.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_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbDate.Selecte dIndexChanged

Try

Dim dt As DateTime =
DateTime.ParseE xact(cmbDate.It ems(cmbDate.Sel ectedIndex), "MMMM d, yyyy",
Nothing)

'loads with the default folder files Cam 1

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

Dim dir As New IO.DirectoryInf o(path)

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

cmbTime.BeginUp date()

cmbTime.Items.C lear()

If files.Length > 0 Then

cmbTime.Items.A ddRange(files)

End If

cmbTime.EndUpda te()

Catch ex As Exception

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

End Try

End Sub

Public Class ApplicationCont rols

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

Dim propInfo As PropertyInfo = _

owner.GetType() .GetProperty(na me, BindingFlags.Ig noreCase Or _

BindingFlags.In stance Or BindingFlags.No nPublic Or BindingFlags.Pu blic)

If Not propInfo Is Nothing Then

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

If TypeOf value Is Control Then

Return value

End If

End If

Return Nothing

End Function

End Class

Private Sub cmbTime_Selecte dIndexChanged(B yVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbTime.Selecte dIndexChanged

Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text

'Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text

For i As Integer = 1 To 8

Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam" & i)

If Not pcb Is Nothing Then

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

'Else

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

End If

Next i

End Sub

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

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

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

:(
"Mike Levine" <na*******@REMO VEcomcast.net> wrote in message
news:eQ******** ******@tk2msftn gp13.phx.gbl...
> What does happen...
> I do not see the Format specifier to change the file name...
>
> Dim folder As String = "C:\Projects\Da rryl\Queue Review Files\" &
> DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
> Nothing).ToStri ng("M-d") & "\Cam {0}\Cam {0}-" & cmbTime.Text
>
> --
> mike
>
> "KitKat" <ki****@nospam. com> wrote in message
> news:%2******** **********@TK2M SFTNGP10.phx.gb l...
>>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.....pleas e help
>>
>> example: C:\Projects\Dar ryl\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\Da rryl\Queue Review Files\" &
>> DateTime.ParseE xact(cmbDate.Se lectedItem.ToSt ring, "MMMM d, yyyy",
>> Nothing).ToStri ng("M-d") & "\Cam {0}\" & cmbTime.Text
>>
>> For i As Integer = 1 To 8
>>
>> Dim pcb As PictureBox = ApplicationCont rols.FindContro l(Me, "pcbCam"
>> & i)
>>
>> If Not pcb Is Nothing Then
>>
>> pcb.Image = Image.FromFile( String.Format(f older, i))
>>
>> 'Else
>>
>> ' pcb.Image = Image.FromFile( "C:\Projects\Da rryl\Queue Review
>> Files\2-24\Cam 7\Cam7-20060224170000-01.jpg")
>>
>> End If
>>
>> Next i
>>
>>
>
>



Mar 24 '06 #10

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

Similar topics

0
1179
by: Hayo Thielecke | last post by:
The deadline for CW'04 has been extended to 15 October. (Authors who have already submitted may resubmit if they like.) --- Hayo Thielecke The Fourth ACM-SIGPLAN Continuations Workshop (CW'04) Venice, Italy, 17 January 2004 co-located with POPL'04 (14--16 January 2004) http://www.cs.bham.ac.uk/~hxt/cw04/index.html Invited Speakers
0
386
by: Guido van Rossum | last post by:
Just a quick reminder: you have another week to submit a proposal for the Python 12 Conference at OSCON: The O'Reilly Open Source Convention (OSCON) will be held July 26-30, 2004 at the Portland Marriott Downtown in Portland, OR. http://conferences.oreillynet.com/os2004/ Proposals Submission Information--Deadline: February 9, 2004...
0
1199
by: Guido van Rossum | last post by:
This is the FINAL reminder: you still have all day today to submit a proposal for the Python 12 Conference at OSCON: The O'Reilly Open Source Convention (OSCON) will be held July 26-30, 2004 at the Portland Marriott Downtown in Portland, OR. http://conferences.oreillynet.com/os2004/ Proposals Submission Information--Deadline: February 9,...
0
1397
by: Martijn Faassen | last post by:
EuroPython news update april 30 =============================== EuroPython early bird registration deadline is may 1, next saturday! After that you pay 60 euros more. Some cheap accomodation also still available, so if you want to attend, hurry and register now! EuroPython is the European Python and Zope Conference. This year in its...
0
1347
by: Steve Holden | last post by:
Pythonistas: If you have been putting off your registration, stop putting it off! Last year the early bird deadline was extended because we were a little late getting the program together. This year the program was published two weeks in advance of the deadline for early bird registrations, which is JANUARY 28 (and it's already January...
0
2501
by: asj | last post by:
from the borg lady: http://www.freeroller.net/page/Sayaka/20030819#walmart_deadline_shows_java_cashing ------------------------------------------------- I/We read with interest Walmart's new edict that suppliers have to be be able to exchange data electronically with it over the internet rather than through private networks....
0
1167
by: A.M. Kuchling | last post by:
The deadline for PyCon proposals is now three weeks away; proposals must be received by Oct. 31st. Read the call for proposals for what we're looking for and how to submit: <http://www.python.org/pycon/2006/cfp> The proposal submission site is <http://submit.python.org>. A.M. Kuchling Chair, PyCon 2006
0
1271
by: jygoh3 | last post by:
ENCYCLOPEDIA OF MOBILE COMPUTING & COMMERCE CALL FOR SHORT ARTICLES Proposal Deadline: 15 Nov 2005 (Extended)
0
1371
by: GHUM | last post by:
We took longer then planned to open the registration. Some potential speakers came in late. To make it even, we extended talk submission deadline for ONE WEEK. New deadline is Friday, 25th of May 2007. So, if you made a fortune with Python: tell others about it at
0
1140
by: David Goodger | last post by:
If you haven't registered for PyCon yet, now is the time! The early-bird registration deadline is February 20, one week away. After that, the price for registration will be going up. http://us.pycon.org/2008/registration/ The deadline for hotel reservations at the conference rate is also February 20. Act now, because the regular rate...
0
7615
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7539
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7581
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5165
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1149
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
858
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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

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