|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DEADLINE! Please help!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 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 -- Show quoteHide quotemike "KitKat" <kitkat@nospam.com> wrote in message news:%2341$2%23uTGHA.5264@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 > > 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 Show quoteHide quote :( "Mike Levine" <nasmas***@REMOVEcomcast.net> wrote in message news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message > news:%2341$2%23uTGHA.5264@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 >> >> > > 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. Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message > news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >> news:%2341$2%23uTGHA.5264@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 >>> >>> >> >> > > 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.SelectedIndex), "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 Show quoteHide quote "Mike Levine" <nasmas***@REMOVEcomcast.net> wrote in message news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message > news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>> news:%2341$2%23uTGHA.5264@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 >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message > news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>> news:%2341$2%23uTGHA.5264@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 >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message > news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>> news:%2341$2%23uTGHA.5264@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 >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message > news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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? Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:ur4KIL1TGHA.4956@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:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message >> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > > So, you are saying that there is a file named Cam2-20060224165648-01.jpg Yes there is a file in each folder of that format.> in the Cam2 folder > Or, is the file in the folder called 20060224165648-01.jpg and you are No, I did try that but I am not adding the Cam2- to the file, it already > just prepending the 'Cam1-' so you know what cam it belongs to? exists. > Does the -01 directly before the extension signify anything? Like the cam Good question, no it doesn't signify anything so there is file in each > number perhaps? 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. Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:%23ONtVQ1TGHA.2276@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" <kitkat@nospam.com> wrote in message > news:ur4KIL1TGHA.4956@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:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message >>> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:%23Y%2365h1TGHA.4452@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:%23ONtVQ1TGHA.2276@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" <kitkat@nospam.com> wrote in message >> news:ur4KIL1TGHA.4956@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:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message >>>> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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! Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:%23ONtVQ1TGHA.2276@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" <kitkat@nospam.com> wrote in message > news:ur4KIL1TGHA.4956@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:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message >>> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > Yup - that will work quite happily as well.
Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:%23lLcQr1TGHA.424@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:%23ONtVQ1TGHA.2276@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" <kitkat@nospam.com> wrote in message >> news:ur4KIL1TGHA.4956@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:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message >>>> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > Thank you very much....it really helped talking to someone.
Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:u0W7cx1TGHA.4132@TK2MSFTNGP11.phx.gbl... > Yup - that will work quite happily as well. > > > "KitKat" <kitkat@nospam.com> wrote in message > news:%23lLcQr1TGHA.424@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:%23ONtVQ1TGHA.2276@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" <kitkat@nospam.com> wrote in message >>> news:ur4KIL1TGHA.4956@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:ePAuRF1TGHA.4340@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" <kitkat@nospam.com> wrote in message >>>>> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>>>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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. Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:u%23n94H1TGHA.4952@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" <kitkat@nospam.com> wrote in message > news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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! Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:%23MOBOL1TGHA.1868@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" <kitkat@nospam.com> wrote in message > news:u%23n94H1TGHA.4952@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" <kitkat@nospam.com> wrote in message >> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > That's not the fully qualified file name.
It should look like <drive>:\<folder>\<folder>...\<filename>.<extension> Show quoteHide quote "KitKat" <kitkat@nospam.com> wrote in message news:%23uNyGT1TGHA.224@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:%23MOBOL1TGHA.1868@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" <kitkat@nospam.com> wrote in message >> news:u%23n94H1TGHA.4952@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" <kitkat@nospam.com> wrote in message >>> news:%23WoNf90TGHA.5464@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:%237ArU9yTGHA.4492@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" <kitkat@nospam.com> wrote in message >>>>> news:OA1UXkyTGHA.5264@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.SelectedIndex), "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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>> news:OdGVvyvTGHA.5808@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" <kitkat@nospam.com> wrote in message >>>>>>> news:%23DDDhevTGHA.1868@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" <nasmas***@REMOVEcomcast.net> wrote in message >>>>>>>> news:eQjOvKvTGHA.4384@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" <kitkat@nospam.com> wrote in message >>>>>>>>> news:%2341$2%23uTGHA.5264@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 >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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 Show quoteHide quote "KitKat" <kitkat@nospam.com> schreef in bericht news:%2341$2%23uTGHA.5264@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 > > 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.SelectedIndex), "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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:uzW9m1wTGHA.4864@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" <kitkat@nospam.com> schreef in bericht > news:%2341$2%23uTGHA.5264@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 >> >> > >
need help on bitblt
Installation Error: Application validation did not succeed. Unable to continue Object Reference not set an instance of an object Serializing custom properties on a BindingList. what is Xtreme Sample Database Multithreading and ActiveX BackgroundWorker and 'freezing' application How program function keys (e.g. F1, F2) in Windows app? set back ground image to stretch how to capture print message |
|||||||||||||||||||||||