We help IT Professionals succeed at work.

DOUBLE PTS combo box to populate six picture boxes.

Kit_Kat111
Kit_Kat111 asked
on
Medium Priority
298 Views
Last Modified: 2011-08-18
*need quick!*

Trying to figure this out and learn in the process.

I have a combo box (cmbTime) with a populated list of jpgs (Cam1-20060224165648-01.jpg) that needs to be displayed in a picture box, however that same file name is also located in six other folders (Cam 1, Cam 2, Cam 4, Cam 6, Cam 7, and Cam 8) using appropiate date selected from another combo box (cmbDate). The six picture boxes are named: pcbCam1, pcbCam2, pcbCam4, pcbCam6, pcbCam7. Can someone help please? I will award double points since I need this quickly and need lots of help! Thank you!!
Comment
Watch Question

Can you specify what you want exactly?

Your combobox contains all the pictures you have?
You will select 1 of them and the application needs to select the pictures from the other folders containing the same date as the selected file and show them in the picturebox?
Something like that?

Author

Commented:
actually....

Author

Commented:
ooops...I meant exactly....can you tell I am tired?
Aaargh..damn mouse.. I typed your complete solution, and then click the awefull backnavigation button on my mouse and lost the whole story.

Well do something like this...create a class containing all your files
create a class containing a single file, exposing FileName and Path

attach the list of fileItem class objects to the datasource of your combobox
set the display member to the FileName

use your files class to get the attached files after you selected a single one
use image objects to load images for them and attach them to your pictureboxes.

Author

Commented:
Whoa...I am just learning this stuff. Plus all my files vary, and are numerous. I really need help coding.......

Author

Commented:
Sorry that I am learning but I have no choice but to ask for help. Thank you for your interest in helping me.

So far this is what I have written up, not much but I am trying.

    Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbTime.SelectedIndexChanged
        'testing

        If cmbDate.SelectedValue Then
            'error msg
        Else
            Select Case cmbDate.SelectedValue = "February 24, 2006"

            get folder 1 = pcbCam1
              get folder 2 = pcbCam2
              get folder 4 = pcbCam4
              get folder 6 = pcbCam6
              get folder 7 = pcbCam7
              get folder 8 = pcbCam8


                Case cmbDate.SelectedValue = "February 27, 2006"

                Case cmbDate.SelectedValue = "February 28, 2006"


            End Select

        End If



    End Sub
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
Here's a guess:

   Private Sub cmbTime_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles   cmbTime.SelectedIndexChanged

       Dim folder As String = "Cam" & Me.cmbDate.SelectedIndex

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

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

    End Sub

Bob

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I appreciate your input!

it seems that path is wrong, I got debug output when I used the combo box:

Cam0\Cam1-20060224165648-01.jpg

Author

Commented:
so I need Cam0 to skip over and start with Cam 1 (with a space)....not my files to rename. :(

Author

Commented:
see you got me started....thank you...part of it is working...

        Dim dt As DateTime = DateTime.ParseExact(cmbDate.Items(cmbDate.SelectedIndex), "MMMM d, yyyy", Nothing)
        Dim folder As String = "C:\Projects\Darryl\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)

First picture is displayed....but I need the other pcbCam# files to be showing too....I am so happy thank you!! This is so much better than a few hours ago!
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Does that mean that you need all 6 displayed at the same time?

Bob

Author

Commented:
I got it working using some case statements ...thank you Bob for your help

Author

Commented:
Yes....I need all working at the same time....I do have a problem with it though....but I will award points first
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
I am still confused about how the images are stored for pcbCam1, pcbCam2, ....  

Are they stored by date?  Are there 6 images for each date in a folder?

Bob

Author

Commented:
still trying to fix this....

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21784980.html


Each jpg is a time stamp, there are six folders which are different camera views. So there will be six pictures (psbCam1) with the same time but at different angles.

Look at my second part of this question from the link above....thank you Bob!

Author

Commented:
can you delete this question?
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.