Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 66
  • Last Modified:

Button click no function after ComboBox SelectedItem Changed

Without clicking on ComboBox, the button works well. But after i have click on ComboBox SelectdItemChanged, the Button doesn't function. For your Info i am not train on VB and i just learn it from article and try it myself. Please advise.
0
Lim HC
Asked:
Lim HC
  • 5
  • 4
1 Solution
 
Ryan ChongCommented:
do you have codes can share with us? we are not too sure what you intend to do without looking into it.
0
 
Lim HCCommented:
Without clicking on ComboBox, the button works well. But after i have click on ComboBox SelectdItemChanged, the Button doesn't function. For your Info i am not train on VB and i just learn it from article and try it myself. Please advise.
 Below are code

Imports System.Windows.Forms


Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Me.Hide()
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim result As DialogResult = MessageBox.Show("Are you sure you want to Proceed?", "Confirmation?", MessageBoxButtons.YesNo)
        If result = DialogResult.Yes Then
            Form2.Show()
        ElseIf result = Windows.Forms.DialogResult.No Then
            Me.Show()
        End If
    End Sub

    Private Sub TblDefectBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs)
        Me.Validate()
        Me.TblDefectBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)

    End Sub
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Database1DataSet.tblDefect' table. You can move, or remove it, as needed.
        Me.TblDefectTableAdapter.Fill(Me.Database1DataSet.tblDefect)

    End Sub
   
    Private Sub Defect_ItemComboBox_SelectedItemChanged(sender As System.Object, e As System.EventArgs) Handles Defect_ItemComboBox.SelectedIndexChanged
        PictureBox1.Image = Nothing
        PictureBox2.Image = Nothing
        PictureBox3.Image = Nothing
        PictureBox4.Image = Nothing
        PictureBox5.Image = Nothing
        PictureBox6.Image = Nothing
        PictureBox7.Image = Nothing
        PictureBox8.Image = Nothing
        If Defect_ItemComboBox.Text = "Cold Solder" Then
            PictureBox1.Image = My.Resources.Cold_Solder1_1
        End If
        If Defect_ItemComboBox.Text = "De-Wetting" Then
            PictureBox1.Image = My.Resources.De_Wetting1_1
            PictureBox2.Image = My.Resources.De_Wetting1_2
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge1" Then
            PictureBox1.Image = My.Resources.bridge1_1
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge2" Then
            PictureBox1.Image = My.Resources.bridge2_1
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge3" Then
            PictureBox1.Image = My.Resources.bridge3_1
            PictureBox5.Image = My.Resources.Prevent_bridge3_1
            PictureBox6.Image = My.Resources.Prevent_bridge3_2
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge4" Then
            PictureBox1.Image = My.Resources.bridge4_1
            PictureBox2.Image = My.Resources.bridge4_2
            PictureBox5.Image = My.Resources.Prevent_bridge4_1
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge5" Then
            PictureBox1.Image = My.Resources.bridge5_1
            PictureBox5.Image = My.Resources.Prevent_bridge5_1
            PictureBox6.Image = My.Resources.Prevent_bridge5_2
        End If
        If Defect_ItemComboBox.Text = "Disturbed Solder" Then
            PictureBox1.Image = My.Resources.Disturbed_Solder1_1
        End If
        If Defect_ItemComboBox.Text = "Excess Solder" Then
            PictureBox1.Image = My.Resources.Excess_Solder1_1
        End If
        If Defect_ItemComboBox.Text = "Insufficient Fill" Then
            PictureBox1.Image = My.Resources.Fill1_1
            PictureBox2.Image = My.Resources.Fill1_2
            PictureBox5.Image = My.Resources.Prevent_fill1_1
        End If
        If Defect_ItemComboBox.Text = "Flux Residue" Then
            PictureBox1.Image = My.Resources.Flux_Residue1_1
        End If
        If Defect_ItemComboBox.Text = "Grainy Joints" Then
            PictureBox1.Image = My.Resources.Grainy1_1
            PictureBox2.Image = My.Resources.Grainy1_2
            PictureBox5.Image = My.Resources.Prevent_grainy1_1
            PictureBox6.Image = My.Resources.Prevent_grainy1_2
        End If
        If Defect_ItemComboBox.Text = "Icicle (Projection or Horn)" Then
            PictureBox1.Image = My.Resources.Icicle1_1
            PictureBox2.Image = My.Resources.Icicle1_2
        End If
        If Defect_ItemComboBox.Text = "Insufficient Solder" Then
            PictureBox1.Image = My.Resources.Insufficient_solder1
            PictureBox2.Image = My.Resources.Insufficient_solder1_2
            PictureBox5.Image = My.Resources.Prevent_insufficient1_1
        End If
        If Defect_ItemComboBox.Text = "Non Wetting" Then
            PictureBox1.Image = My.Resources.Non_Wetting1_1
            PictureBox2.Image = My.Resources.Non_Wetting1_2
        End If
        If Defect_ItemComboBox.Text = "Pin hole1" Then
            PictureBox1.Image = My.Resources.Pin_hole1_1
            PictureBox2.Image = My.Resources.Pin_hole1_2
        End If
        If Defect_ItemComboBox.Text = "Pin hole2" Then
            PictureBox1.Image = My.Resources.Pin_hole2_1
            PictureBox2.Image = My.Resources.Pin_hole2_2
        End If
        If Defect_ItemComboBox.Text = "Pin hole3" Then
            PictureBox1.Image = My.Resources.Pin_hole3_1
            PictureBox2.Image = My.Resources.Pin_hole3_2
        End If
        If Defect_ItemComboBox.Text = "Random Solder Ball" Then
            PictureBox1.Image = My.Resources.SB1_1
            PictureBox2.Image = My.Resources.SB1_2
            PictureBox5.Image = My.Resources.Prevent_SB1_1
        End If
        If Defect_ItemComboBox.Text = "Chip side ball" Then
            PictureBox1.Image = My.Resources.Side_ball1_1
            PictureBox5.Image = My.Resources.Prevent_side_ball1_1
            PictureBox6.Image = My.Resources.Prevent_side_ball1_2
        End If
        If Defect_ItemComboBox.Text = "Solder Skip1" Then
            PictureBox1.Image = My.Resources.Skip1_1
            PictureBox2.Image = My.Resources.Skip1_2
            PictureBox3.Image = My.Resources.Skip1_3
            PictureBox4.Image = My.Resources.Skip1_4
            PictureBox5.Image = My.Resources.Prevent_skip1_1
            PictureBox6.Image = My.Resources.Prevent_skip1_2
            PictureBox7.Image = My.Resources.Prevent_skip1_3
        End If
        If Defect_ItemComboBox.Text = "Solder Skip2" Then
            PictureBox1.Image = My.Resources.Skip2_1
            PictureBox2.Image = My.Resources.Skip2_2
            PictureBox5.Image = My.Resources.Prevent_skip2_1
        End If
        If Defect_ItemComboBox.Text = "Spattering1" Then
            PictureBox1.Image = My.Resources.Spatter1_1
        End If
        If Defect_ItemComboBox.Text = "Spattering2" Then
            PictureBox1.Image = My.Resources.Spatter2_1
            PictureBox2.Image = My.Resources.Spatter2_2
            PictureBox5.Image = My.Resources.Prevent_spatter2_1
        End If
        If Defect_ItemComboBox.Text = "Tombstoning" Then
            PictureBox1.Image = My.Resources.Ts1_1
            PictureBox2.Image = My.Resources.Ts1_2
            PictureBox5.Image = My.Resources.Prevent_ts1_1
            PictureBox6.Image = My.Resources.Prevent_ts1_2
            PictureBox7.Image = My.Resources.Prevent_ts1_3
        End If
        If Defect_ItemComboBox.Text = "Voids" Then
            PictureBox1.Image = My.Resources.Void1_1
            PictureBox2.Image = My.Resources.Void1_2
            PictureBox3.Image = My.Resources.Void1_3
            PictureBox5.Image = My.Resources.Prevent_void1_1
            PictureBox6.Image = My.Resources.Prevent_void1_2
            PictureBox7.Image = My.Resources.Prevent_void1_3
            PictureBox8.Image = My.Resources.Prevent_void1_4
        End If
        If Defect_ItemComboBox.Text = "Webbing" Then
            PictureBox1.Image = My.Resources.Webbing1_1
        End If
    End Sub
End Class
0
 
Ryan ChongCommented:
pls see if the explanation below is correct?

you got Defect_ItemComboBox which will change the image of pictureboxes?
you got 2 buttons in your form:
-Button1 will hide your form
-Button2 will prompt a dialog box with selection of Yes, No. If user selected Yes, it will show Form 2.

>>the Button doesn't function
can you explain this a bit further?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Lim HCEngineerAuthor Commented:
Hi Ryan,
Before i click on Combobox to select item, the button is functioning as i assign. but after i click on Combobox to select item, the both button does not function.
0
 
Ryan ChongCommented:
the 2 buttons' Click events are pretty simple, i don't think if you adding the SelectedItemChanged event of comboxbox will affect how these buttons behaved.

do you have a sample project can upload here? we will try to diagnose it.
0
 
Lim HCEngineerAuthor Commented:
Hi Expert,
Below are the program which i used. please advise

Imports System.Windows.Forms

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Me.Hide()
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim result As DialogResult = MessageBox.Show("Are you sure you want to Proceed?", "Confirmation?", MessageBoxButtons.YesNo)
        If result = DialogResult.Yes Then
            Form2.Show()
        ElseIf result = Windows.Forms.DialogResult.No Then
            Me.Show()
        End If
    End Sub

    Private Sub TblDefectBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs)
        Me.Validate()
        Me.TblDefectBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)

    End Sub
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Database1DataSet.tblDefect' table. You can move, or remove it, as needed.
        Me.TblDefectTableAdapter.Fill(Me.Database1DataSet.tblDefect)

    End Sub
   
    Private Sub Defect_ItemComboBox_SelectedItemChanged(sender As System.Object, e As System.EventArgs) Handles Defect_ItemComboBox.SelectedIndexChanged
        PictureBox1.Image = Nothing
        PictureBox2.Image = Nothing
        PictureBox3.Image = Nothing
        PictureBox4.Image = Nothing
        PictureBox5.Image = Nothing
        PictureBox6.Image = Nothing
        PictureBox7.Image = Nothing
        PictureBox8.Image = Nothing
        If Defect_ItemComboBox.Text = "Cold Solder" Then
            PictureBox1.Image = My.Resources.Cold_Solder1_1
        End If
        If Defect_ItemComboBox.Text = "De-Wetting" Then
            PictureBox1.Image = My.Resources.De_Wetting1_1
            PictureBox2.Image = My.Resources.De_Wetting1_2
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge1" Then
            PictureBox1.Image = My.Resources.bridge1_1
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge2" Then
            PictureBox1.Image = My.Resources.bridge2_1
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge3" Then
            PictureBox1.Image = My.Resources.bridge3_1
            PictureBox5.Image = My.Resources.Prevent_bridge3_1
            PictureBox6.Image = My.Resources.Prevent_bridge3_2
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge4" Then
            PictureBox1.Image = My.Resources.bridge4_1
            PictureBox2.Image = My.Resources.bridge4_2
            PictureBox5.Image = My.Resources.Prevent_bridge4_1
        End If
        If Defect_ItemComboBox.Text = "Solder Bridge5" Then
            PictureBox1.Image = My.Resources.bridge5_1
            PictureBox5.Image = My.Resources.Prevent_bridge5_1
            PictureBox6.Image = My.Resources.Prevent_bridge5_2
        End If
        If Defect_ItemComboBox.Text = "Disturbed Solder" Then
            PictureBox1.Image = My.Resources.Disturbed_Solder1_1
        End If
        If Defect_ItemComboBox.Text = "Excess Solder" Then
            PictureBox1.Image = My.Resources.Excess_Solder1_1
        End If
        If Defect_ItemComboBox.Text = "Insufficient Fill" Then
            PictureBox1.Image = My.Resources.Fill1_1
            PictureBox2.Image = My.Resources.Fill1_2
            PictureBox5.Image = My.Resources.Prevent_fill1_1
        End If
        If Defect_ItemComboBox.Text = "Flux Residue" Then
            PictureBox1.Image = My.Resources.Flux_Residue1_1
        End If
        If Defect_ItemComboBox.Text = "Grainy Joints" Then
            PictureBox1.Image = My.Resources.Grainy1_1
            PictureBox2.Image = My.Resources.Grainy1_2
            PictureBox5.Image = My.Resources.Prevent_grainy1_1
            PictureBox6.Image = My.Resources.Prevent_grainy1_2
        End If
        If Defect_ItemComboBox.Text = "Icicle (Projection or Horn)" Then
            PictureBox1.Image = My.Resources.Icicle1_1
            PictureBox2.Image = My.Resources.Icicle1_2
        End If
        If Defect_ItemComboBox.Text = "Insufficient Solder" Then
            PictureBox1.Image = My.Resources.Insufficient_solder1
            PictureBox2.Image = My.Resources.Insufficient_solder1_2
            PictureBox5.Image = My.Resources.Prevent_insufficient1_1
        End If
        If Defect_ItemComboBox.Text = "Non Wetting" Then
            PictureBox1.Image = My.Resources.Non_Wetting1_1
            PictureBox2.Image = My.Resources.Non_Wetting1_2
        End If
        If Defect_ItemComboBox.Text = "Pin hole1" Then
            PictureBox1.Image = My.Resources.Pin_hole1_1
            PictureBox2.Image = My.Resources.Pin_hole1_2
        End If
        If Defect_ItemComboBox.Text = "Pin hole2" Then
            PictureBox1.Image = My.Resources.Pin_hole2_1
            PictureBox2.Image = My.Resources.Pin_hole2_2
        End If
        If Defect_ItemComboBox.Text = "Pin hole3" Then
            PictureBox1.Image = My.Resources.Pin_hole3_1
            PictureBox2.Image = My.Resources.Pin_hole3_2
        End If
        If Defect_ItemComboBox.Text = "Random Solder Ball" Then
            PictureBox1.Image = My.Resources.SB1_1
            PictureBox2.Image = My.Resources.SB1_2
            PictureBox5.Image = My.Resources.Prevent_SB1_1
        End If
        If Defect_ItemComboBox.Text = "Chip side ball" Then
            PictureBox1.Image = My.Resources.Side_ball1_1
            PictureBox5.Image = My.Resources.Prevent_side_ball1_1
            PictureBox6.Image = My.Resources.Prevent_side_ball1_2
        End If
        If Defect_ItemComboBox.Text = "Solder Skip1" Then
            PictureBox1.Image = My.Resources.Skip1_1
            PictureBox2.Image = My.Resources.Skip1_2
            PictureBox3.Image = My.Resources.Skip1_3
            PictureBox4.Image = My.Resources.Skip1_4
            PictureBox5.Image = My.Resources.Prevent_skip1_1
            PictureBox6.Image = My.Resources.Prevent_skip1_2
            PictureBox7.Image = My.Resources.Prevent_skip1_3
        End If
        If Defect_ItemComboBox.Text = "Solder Skip2" Then
            PictureBox1.Image = My.Resources.Skip2_1
            PictureBox2.Image = My.Resources.Skip2_2
            PictureBox5.Image = My.Resources.Prevent_skip2_1
        End If
        If Defect_ItemComboBox.Text = "Spattering1" Then
            PictureBox1.Image = My.Resources.Spatter1_1
        End If
        If Defect_ItemComboBox.Text = "Spattering2" Then
            PictureBox1.Image = My.Resources.Spatter2_1
            PictureBox2.Image = My.Resources.Spatter2_2
            PictureBox5.Image = My.Resources.Prevent_spatter2_1
        End If
        If Defect_ItemComboBox.Text = "Tombstoning" Then
            PictureBox1.Image = My.Resources.Ts1_1
            PictureBox2.Image = My.Resources.Ts1_2
            PictureBox5.Image = My.Resources.Prevent_ts1_1
            PictureBox6.Image = My.Resources.Prevent_ts1_2
            PictureBox7.Image = My.Resources.Prevent_ts1_3
        End If
        If Defect_ItemComboBox.Text = "Voids" Then
            PictureBox1.Image = My.Resources.Void1_1
            PictureBox2.Image = My.Resources.Void1_2
            PictureBox3.Image = My.Resources.Void1_3
            PictureBox5.Image = My.Resources.Prevent_void1_1
            PictureBox6.Image = My.Resources.Prevent_void1_2
            PictureBox7.Image = My.Resources.Prevent_void1_3
            PictureBox8.Image = My.Resources.Prevent_void1_4
        End If
        If Defect_ItemComboBox.Text = "Webbing" Then
            PictureBox1.Image = My.Resources.Webbing1_1
        End If
    End Sub
End Class
Project2.vbproj
0
 
Ryan ChongCommented:
hi,

.vbproj is not good enough... what i mean is the full proj files.

is it possible to upload it? You can zip and upload the project files.

it's quite impossible for us to rebuild a project just to simulate your issue.
0
 
Lim HCEngineerAuthor Commented:
Hi expert,
 Sorry, i will upload the folder. Hope it will help to solve my problem. Thank you.
Project2.zip
0
 
Ryan ChongCommented:
something wrong with your initial binding i guess?

I resolved the issue by rebinding the controls in your form.

check this out.
https://dl.dropboxusercontent.com/u/39360237/Project2_b.zip
(I was not able to upload via EE)
0
 
Lim HCEngineerAuthor Commented:
Thank you very much Ryan
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now