Hey can anyone help me out with this code? Im am really stuck and need to complete it for my engineering degree but none of lecturers have any coding knowledge so im really in trouble. I have a GUI and in the GUI is 3 comboboxes with different options. Depending on the options selected i want certain images to load in picture boxes when a button is clicked. The code i have written is below but it causing me a problem. The first three IF's are for a variable called 'camber'. When the code stopped here and the GUi was run it worked fine. Then i added the next 3 IF's for the second variable called 'camber position'. This time the gui only loaded 'camber postion' images not 'camber' even if camber was selected from the combobox. A freind explained to me that the code my be runnig through all possible slections and only displaying the last one from the code. Therefore i need to somehow put in a loop or pause?? Can anyone help me out? Im pretty new to this and not really sure what im doing, with nobody to help me im pretty lost.

Thanks, would appreciate any advice anyone has to offer.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If (ComboBox1.SelectedIndex = 0) And (ComboBox2.SelectedIndex = 0) And (ComboBox3.SelectedIndex = 0) Then


            PictureBox1.Image = My.Resources.Cl_Alpha_camberRE2
            PictureBox2.Image = My.Resources.Naca4415_Reduced_camber
            PictureBox3.Image = My.Resources.Naca4415
            PictureBox4.Image = My.Resources.Naca4415_Increased_camber
            Label6.Text = "Reduceded camber "
            Label7.Text = "Standard Naca4415 camber "
            Label8.Text = "Increased camber"

        End If

        If (ComboBox1.SelectedIndex = 0) And (ComboBox2.SelectedIndex = 0) And (ComboBox3.SelectedIndex = 1) Then

            PictureBox1.Image = My.Resources.Cl_Alpha_camberRE4
            PictureBox2.Image = My.Resources.Naca4415_Reduced_camber
            PictureBox3.Image = My.Resources.Naca4415
            PictureBox4.Image = My.Resources.Naca4415_Increased_camber
            Label6.Text = "Reduceded camber "
            Label7.Text = "Standard Naca4415 camber "
            Label8.Text = "Increased camber"
        End If

        If (ComboBox1.SelectedIndex = 0) And (ComboBox2.SelectedIndex = 0) And (ComboBox3.SelectedIndex = 2) Then

            PictureBox1.Image = My.Resources.Cl_Alpha_camberRE6
            PictureBox2.Image = My.Resources.Naca4415_Reduced_camber
            PictureBox3.Image = My.Resources.Naca4415
            PictureBox4.Image = My.Resources.Naca4415_Increased_camber
            Label6.Text = "Reduced camber"
            Label7.Text = "Standard Naca4415 camber"
            Label8.Text = "Increased camber"
        End If
        If (ComboBox1.SelectedIndex = 0) And (ComboBox2.SelectedIndex = 1) And (ComboBox3.SelectedIndex = 0) Then
            PictureBox1.Image = My.Resources.Cl_Alpha_camberPOSRE2
            PictureBox2.Image = My.Resources.Naca4415_Forward_camber
            PictureBox3.Image = My.Resources.Naca4415
            PictureBox4.Image = My.Resources.Naca4415_Aft_camber
            Label6.Text = "Foward camber "
            Label7.Text = "Standard Naca4415 camber "
            Label8.Text = "Aft camber"

        End If

        If (ComboBox1.SelectedIndex = 0) And (ComboBox2.SelectedIndex = 1) And (ComboBox3.SelectedIndex = 1) Then

            PictureBox1.Image = My.Resources.Cl_Alpha_camberPOSRE4
            PictureBox2.Image = My.Resources.Naca4415_Forward_camber
            PictureBox3.Image = My.Resources.Naca4415
            PictureBox4.Image = My.Resources.Naca4415_Aft_camber
            Label6.Text = "Foward camber "
            Label7.Text = "Standard Naca4415 camber "
            Label8.Text = "Aft camber"
        End If

        If (ComboBox1.SelectedIndex = 0) And (ComboBox2.SelectedIndex = 1) And (ComboBox3.SelectedIndex = 2) Then
            PictureBox1.Image = My.Resources.Cl_Alpha_camberPOSRE6
            PictureBox2.Image = My.Resources.Naca4415_Forward_camber
            PictureBox3.Image = My.Resources.Naca4415
            PictureBox4.Image = My.Resources.Naca4415_Aft_camber
            Label6.Text = "Foward camber "
            Label7.Text = "Standard Naca4415 camber "
            Label8.Text = "Aft camber"
        End If
    End Sub
End Class

it actually seems to be working ok now. I fixed it but not sure how! Sorry for the post, thanks for the reply.

This article has been dead for over six months. Start a new discussion instead.