[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2009-02-15
3
Medium Priority
?
448 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
0
Comment
Question by:si2030
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 23645823
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

0
 

Author Comment

by:si2030
ID: 23646913
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
0
 

Author Closing Comment

by:si2030
ID: 31547078
I managed to get sendKeys to work within editcontrolshowing directly.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

829 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