We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

si2030
si2030 asked
on
Medium Priority
507 Views
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?

Simon
Comment
Watch Question

IT Pro/Developer
CERTIFIED EXPERT
Top Expert 2008
Commented:
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()
        Application.DoEvents()
        SendKeys.Send("{TAB}")
    End Sub

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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.

http://www.screencast.com/users/si2030/folders/Jing/media/94cb4bb2-9731-4c02-83c7-e5ec7cca1e29

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...

Simon

Author

Commented:
I managed to get sendKeys to work within editcontrolshowing directly.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.