Editable datagridview combobox not working...

Hi Experts

I am having trouble with an editable combobox for a datagridview. The coe I am using has been obtained from Here:

http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/dc2e02c1-0ef7-4721-a075-75e1b37ba1a9/#page:1

I using this code:

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

        If dgvCreditorInvoiceDetail.CurrentCellAddress.X = accountComboBox.DisplayIndex Then

            Dim cmb As ComboBox = CType(e.Control, ComboBox)

            If Not cmb Is Nothing Then

                cmb.DropDownStyle = ComboBoxStyle.DropDown

            End If
End sub

My problem is that the line with "accountComboBox.DisplayIndex has a value of  "-1" and so skips the rest of the lines and this was for the combobox I wanted to be editable.

The "dgvCreditorInvoiceDetail.CurrentCellAddress.X" equals 0...

What am I missing here? How can I get this combobox to be editable?

Simon
si2030Asked:
Who is Participating?
 
Jorge PaulinoIT Pro/DeveloperCommented:
Is accountComboBox.DisplayIndex  the right combo (the datagridview combo) ?
0
 
si2030Author Commented:
Hi there jPaulino,

Good Question! Just found that when I moved the creation of the combobox up to the variables I didnt delete the combobox creation in the sub it was originally created in...

Re-tested it and it now works.

Thanks..

Simon
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.