si2030
asked on
Autocomplete on datagridview combobox
Hi Experts,
I have a datagridview that has as its first column is a datagridviewcombobox.
I have made this editable (thanks to those on this site) however I would like to make it so that if the user clicks on combobox and then starts typing that combobox will match the first item in the drop down list with whats been typed...
I have done this no problem with normal comboboxes however how do I trap and manage keystrokes for a particular datagridviewcombobox and use something like findstring..?
Simon
I have a datagridview that has as its first column is a datagridviewcombobox.
I have made this editable (thanks to those on this site) however I would like to make it so that if the user clicks on combobox and then starts typing that combobox will match the first item in the drop down list with whats been typed...
I have done this no problem with normal comboboxes however how do I trap and manage keystrokes for a particular datagridviewcombobox and use something like findstring..?
Simon
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
cmb.SelectedIndex = -1
End If
End If
ASKER
Hi again jpaulino
Also wondering where this code goes? Not sure where this is placed.
Kind Regards
Simon
Also wondering where this code goes? Not sure where this is placed.
Kind Regards
Simon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Jpaulino
I did have it in the right place but in the dropdown list I had placed a space at the from so it never found anything..
I have another JING here. The dropdown autocomplete list is only as wide as the box... is there a way to automatically reveal the whole dropdown?
http://www.screencast.com/users/si2030/folders/Jing/media/acf1f054-e901-4d86-9964-36bc8490932d
I did have it in the right place but in the dropdown list I had placed a space at the from so it never found anything..
I have another JING here. The dropdown autocomplete list is only as wide as the box... is there a way to automatically reveal the whole dropdown?
http://www.screencast.com/users/si2030/folders/Jing/media/acf1f054-e901-4d86-9964-36bc8490932d
Hummm .... I see!
But that's a limitation and I don't know if exists a way to achive that.
You may need to increase the column or use only one thing (code or description), if that ok for you. You can also use the code (if the user is familiar with that) and show the description on a new column.
But that's a limitation and I don't know if exists a way to achive that.
You may need to increase the column or use only one thing (code or description), if that ok for you. You can also use the code (if the user is familiar with that) and show the description on a new column.
ASKER
Perhaps I could manage the process by code instead of automatically. I could control the behavour better.
Is there a way to force the datagridviewcombobox to drop the list?
I will set this question to accept solution and ask a more direct question after this...
Is there a way to force the datagridviewcombobox to drop the list?
I will set this question to accept solution and ask a more direct question after this...
ASKER
On the money... thanks simon
I have added datagridview with a column set to DataGridViewComboBoxColumn . I have also added
the EditingControlShowing event to set the combobox to AutoCompleteMode.Suggest and .AutoCompleteSource = AutoCompleteSource.ListIte ms
My problem is that at times, when I type on the combobox, the dropdown list shows items but of a bigger font size. I have tried setting the font size in the EditingControlShowing event. But it does not work. Is there a way to set a fixed font size?
the EditingControlShowing event to set the combobox to AutoCompleteMode.Suggest and .AutoCompleteSource = AutoCompleteSource.ListIte
My problem is that at times, when I type on the combobox, the dropdown list shows items but of a bigger font size. I have tried setting the font size in the EditingControlShowing event. But it does not work. Is there a way to set a fixed font size?
Hi,
You have to create a new question and maybe show a screenshot of your problem to a easy solution (if there is)
Open in new window