Editable datagridview combobox not working...

Posted on 2009-02-13
Last Modified: 2012-05-06
Hi Experts

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

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?

Question by:si2030
    LVL 48

    Accepted Solution

    Is accountComboBox.DisplayIndex  the right combo (the datagridview combo) ?

    Author Closing Comment

    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.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now