How to fire the selected index changed event when combobox exists in a datagridview?

Hi experts
Using vb2008 express I have a datagridview with 3 colums, one is a comboboxcolumn and the other 2 are textbox columns, they are called cboAmount, txtPrice and txtTotalPrice, what i want to happen is when a number is selected in the combo-box it will be multiplied by the price and display the total price, if these controls were not in a datagridview I would simply use the selectedIndexChanged event of the combobox to do these calculations but what event can i use to do this when the combo-box exists in a datagridview?

Hope somebody can help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
How have you added the combobox to the datagridview?
Jorge PaulinoIT Pro/DeveloperCommented:
Here's a small example how you can achieve that:
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dgvCombo As DataGridViewComboBoxColumn = DirectCast(Me.Column3, DataGridViewComboBoxColumn)
    End Sub

    Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing

        ' 2 = Column Index
        If Me.DataGridView1.CurrentCell.ColumnIndex = 2 Then
            Dim cb As ComboBox = DirectCast(e.Control, ComboBox)
            AddHandler cb.SelectedIndexChanged, AddressOf comboBox_SelectedIndexChanged
        End If

    End Sub

    Sub comboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        MessageBox.Show("ComboBox Changed!")
    End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dizzycatAuthor Commented:
Thanks jpaulino. This works great, i can now use the SelectedIndexChanged Event for a combo-box in a datagridview.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.