Need help adding to a file name to display

Shaggycat

Member
Joined
Mar 22, 2006
Messages
8
Programming Experience
Beginner
Okay all of this is working but now I need to get button called "previous" to work. I need to minus one second to the file (actually subtracting a 1 from the file name) and then display the pictures with that change. I really have no idea how to do this.

file is broken up like this:
Cam1-20060224165650-01.jpg

Cam1 -2006 02 24 1656 50 -01.jpg
+1
so adding it will be Cam1-200602224165651-01.jpg

so would that be the cmbTime.text below?

Thanks in advance for the 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}\Cam{0}" & cmbTime.Text.Substring(cmbTime.Text.IndexOf("-"))

For i As Integer = 1 To 8

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

If Not pcb Is Nothing Then

If File.Exists(String.Format(folder, i)) Then
pcb.Image = Image.FromFile(String.Format(folder, i))
Else
pcb.Image = Image.FromFile("C:\Projects\Darryl\Queue Review Files\noimage.jpg")
End If
End If

Next i
 
oops....should have put that in code format text - sorry about that.

For example:
Cam1-200602224165651-01.jpg
XXXXXXXXXXXXXXXX-1XXXXXX
Need to subtract 1 on the file 5651-01.jpg to 5650-01.jpg
 
Just Split the file name on the dashes. Convert the middle substring to a number and perfrom your mathematics, then convert it back to a string. Recombine the parts to form the new file name. Look at String.Split and String.Join.
 
Back
Top