473,378 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Learning - displaying selection in pictureboxes

Problem trying to figure this out, using a combo box selection I need to go
to each folder, Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,and Cam 8 and display each
picture (from selection) from each folder and display in pictureboxes
pcbCam1, pcbCam2, pcbCam4, pcbCam6, pcbCam7, and pcbCam8.

So far the code works for one picture box not the others. Also when I
reenter a different date the counter (+1) messes up....HELP

Dim dt As DateTime = DateTime.ParseExact(cmbDate.Items(cmbDate.Selected
Index), "MMMM d, yyyy", Nothing)
Dim folder As String = "C:\Projects\Dar\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam " & Me.cmbDate.SelectedIndex + 1

Dim fileName As String = folder & "\" & Me.cmbTime.Text

Me.pcbCam1.Image = Image.FromFile(fileName)
Mar 23 '06 #1
4 1396
KitKat wrote:
Problem trying to figure this out, using a combo box selection I need to go
to each folder, Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,and Cam 8 and display each
picture (from selection) from each folder and display in pictureboxes
pcbCam1, pcbCam2, pcbCam4, pcbCam6, pcbCam7, and pcbCam8.

So far the code works for one picture box not the others. Also when I
reenter a different date the counter (+1) messes up....HELP

Dim dt As DateTime = DateTime.ParseExact(cmbDate.Items(cmbDate.Selected
Index), "MMMM d, yyyy", Nothing)
Dim folder As String = "C:\Projects\Dar\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam " & Me.cmbDate.SelectedIndex + 1

Dim fileName As String = folder & "\" & Me.cmbTime.Text

Me.pcbCam1.Image = Image.FromFile(fileName)


have you looked at the value of fileName to see if it is valid? I don't
see any counter in your code.

Also, it's simpler to get the selected item this way.

Dim dt As DateTime = DateTime.ParseExact(cmbDate.SelectedItem.ToString,
"MMMM d, yyy", Nothing)

Chris
Mar 23 '06 #2
KitKat,

Not only globalization gives problems with dates. (Date and time
representation are not used in an equal way in the world. That in the way we
note them. If we start talking about speaking them there is even more
difference).

However, your combobox returns a string. Don't therefore thinking on my
previous sentence try to bring it back to a DateTime there is no need for
that.

Just use the split in your case to get the elements you want.

dim TheDateItems() as string = cmbDateItems.split(" "c)

It is not important for you that it are date elements, it are just some
values to fill in your path string.

I hope this helps,

Cor

"KitKat" <ki****@nospam.com> schreef in bericht
news:e%****************@TK2MSFTNGP14.phx.gbl...
Problem trying to figure this out, using a combo box selection I need to
go to each folder, Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,and Cam 8 and display
each picture (from selection) from each folder and display in pictureboxes
pcbCam1, pcbCam2, pcbCam4, pcbCam6, pcbCam7, and pcbCam8.

So far the code works for one picture box not the others. Also when I
reenter a different date the counter (+1) messes up....HELP

Dim dt As DateTime = DateTime.ParseExact(cmbDate.Items(cmbDate.Selected
Index), "MMMM d, yyyy", Nothing)
Dim folder As String = "C:\Projects\Dar\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam " & Me.cmbDate.SelectedIndex + 1

Dim fileName As String = folder & "\" & Me.cmbTime.Text

Me.pcbCam1.Image = Image.FromFile(fileName)

Mar 23 '06 #3
From what you appear to be attemptinf to do, one must assume that the
drop-down portion of your ComboBox displays a list of dates and that when an
item in the drop-list is selected, ALL 8 pictureboxes should display the
image for the selected date and specified time from the corresponding
directory. If that is the case then what you need could be as simple as:

Dim folder As String = "C:\Projects\Dar\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
Select Case i
Case 1
pcbCam1.Image = Image.FromFile(String.Format(folder, i))

Case 2
pcbCam2.Image = Image.FromFile(String.Format(folder, i))

Case 3
pcbCam3.Image = Image.FromFile(String.Format(folder, i))

Case 4
pcbCam4.Image = Image.FromFile(String.Format(folder, i))

Case 5
pcbCam5.Image = Image.FromFile(String.Format(folder, i))

Case 6
pcbCam6.Image = Image.FromFile(String.Format(folder, i))

Case 7
pcbCam7.Image = Image.FromFile(String.Format(folder, i))

Case 8
pcbCam8.Image = Image.FromFile(String.Format(folder, i))
End Select
Next
"KitKat" <ki****@nospam.com> wrote in message
news:e%****************@TK2MSFTNGP14.phx.gbl...
Problem trying to figure this out, using a combo box selection I need to
go to each folder, Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,and Cam 8 and display
each picture (from selection) from each folder and display in pictureboxes
pcbCam1, pcbCam2, pcbCam4, pcbCam6, pcbCam7, and pcbCam8.

So far the code works for one picture box not the others. Also when I
reenter a different date the counter (+1) messes up....HELP

Dim dt As DateTime = DateTime.ParseExact(cmbDate.Items(cmbDate.Selected
Index), "MMMM d, yyyy", Nothing)
Dim folder As String = "C:\Projects\Dar\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam " & Me.cmbDate.SelectedIndex + 1

Dim fileName As String = folder & "\" & Me.cmbTime.Text

Me.pcbCam1.Image = Image.FromFile(fileName)

Mar 23 '06 #4
Thanks for all the inputs:

Stephany, your assistance really helped I got it all working. So thank you
very much!!
"Stephany Young" <noone@localhost> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
From what you appear to be attemptinf to do, one must assume that the
drop-down portion of your ComboBox displays a list of dates and that when
an item in the drop-list is selected, ALL 8 pictureboxes should display
the image for the selected date and specified time from the corresponding
directory. If that is the case then what you need could be as simple as:

Dim folder As String = "C:\Projects\Dar\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
Select Case i
Case 1
pcbCam1.Image = Image.FromFile(String.Format(folder, i))

Case 2
pcbCam2.Image = Image.FromFile(String.Format(folder, i))

Case 3
pcbCam3.Image = Image.FromFile(String.Format(folder, i))

Case 4
pcbCam4.Image = Image.FromFile(String.Format(folder, i))

Case 5
pcbCam5.Image = Image.FromFile(String.Format(folder, i))

Case 6
pcbCam6.Image = Image.FromFile(String.Format(folder, i))

Case 7
pcbCam7.Image = Image.FromFile(String.Format(folder, i))

Case 8
pcbCam8.Image = Image.FromFile(String.Format(folder, i))
End Select
Next
"KitKat" <ki****@nospam.com> wrote in message
news:e%****************@TK2MSFTNGP14.phx.gbl...
Problem trying to figure this out, using a combo box selection I need to
go to each folder, Cam 1, Cam 2, Cam 4, Cam 6, Cam 7,and Cam 8 and
display each picture (from selection) from each folder and display in
pictureboxes pcbCam1, pcbCam2, pcbCam4, pcbCam6, pcbCam7, and pcbCam8.

So far the code works for one picture box not the others. Also when I
reenter a different date the counter (+1) messes up....HELP

Dim dt As DateTime = DateTime.ParseExact(cmbDate.Items(cmbDate.Selected
Index), "MMMM d, yyyy", Nothing)
Dim folder As String = "C:\Projects\Dar\Queue Review Files\" & dt.Month &
"-" & dt.Day & "\Cam " & Me.cmbDate.SelectedIndex + 1

Dim fileName As String = folder & "\" & Me.cmbTime.Text

Me.pcbCam1.Image = Image.FromFile(fileName)


Mar 23 '06 #5

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

Similar topics

7
by: Scott Mackay | last post by:
Hi, I'm using visual studio dotnet 2002 programming in vb can anyone tell me how I can handle the mousedown event for pictureboxes I create dynamically at runtime? I've tried setting the...
36
by: utab | last post by:
Dear, I have experince in C( numerical projects, like engineering problems, scientific applications) I have the basic notion of C++ also, I have read Accelerated C++ until Chapter 7, however it...
1
by: slayerx | last post by:
Quote: Originally Posted by comteck As far as I know, a report is just that.. a means of displaying data. I don't believe it is possible to make a selection in a report. You can however, make a...
0
by: Blarneystone | last post by:
I am pulling my hair out over this one. I've got a picturebox with just a simple gradient as the background for my interface. It is in 16bit RGB color. I've created some pictures I'll use as...
1
by: pankajswain | last post by:
i have taken a combo box and sets the property c omboBox1.DropDownStyle = ComboBoxStyle.Simple; at run time. autocomplete mode:SuggestAppend autocompletesource:List items i have taken some...
3
by: manxie | last post by:
Dear All Readers, I'm supposed to create a program with a switch and using voids to execute number of codes, that includes finding sum, average, maximum, and minimum, please read my code:...
2
by: djpaul | last post by:
Heey! For my program i need to create pictureboxes on the fly. After adding pictures to the database with a surten folder you can eddit the pictures or the text that's with it. But when i select a...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: vinod allapu | last post by:
Hi all, I am working with mobileforms. The problem is after having the datatable in hand how can i display on mobile form. I tried with data gridview but it is not available in mobile parts....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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

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