datagridviewcombobox autocomplete - force caret to next cell in row on autocomplete.

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

I have a datagridviewcombobox that has been set to edit and autocomplete suggestappend.

If I click on one of the drop down items it popuates the combobox. Thats fine.

How can I force the focus to the next cell in the row apon a selection in the dropdown list?

Question by:si2030
    LVL 48

    Accepted Solution

    Try something like this (not fully tested)
        Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
            If Me.DataGridView1.CurrentRow.Index = ComboColumn.DisplayIndex Then
                Dim cmb As ComboBox = CType(e.Control, ComboBox)
                AddHandler cmb.SelectedIndexChanged, AddressOf cmbSelectedIndexChanged
            End If
        End Sub
        Sub cmbSelectedIndexChanged()
        End Sub

    Open in new window


    Author Comment

    Hi jpaulino,

    I did try that.  Unfortunately it didnt work. As soon as I clicked on the combobox it sent me to the next cell.

    It seems that the very process of clicking on it changes the selectedindex. I then tried selectedvalue changed and that worked only when there was a breakpoint added...


    Author Closing Comment

    I managed to get sendKeys to work within editcontrolshowing directly.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 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