p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Visual Studio 2005 (http://p2p.wrox.com/visual-studio-2005-140/)
-   -   DataGridView autocomplete (http://p2p.wrox.com/visual-studio-2005/64622-datagridview-autocomplete.html)

pencilneck December 17th, 2007 11:31 AM

DataGridView autocomplete
 
I want to use autocomplete in a texbox or combobox inside a datagridview, but AutoCompleteMode, AutoCompleteSource and AutoCompleteCustomSource properties are only available in the details combobox, not in the DataGridView.

Does anyone have an idea how to get around this? Maybe some code in the EditingControlShowing event or something?

Thanks in advance.
pencilneck




pencilneck December 17th, 2007 01:11 PM

Here's the code that answers my own question:
(These are unique to my app: aName, qryName, name, Name, LName, Position)

Public Class InputForm
    Dim aName As New AutoCompleteStringCollection()

Private Sub InputForm_Load(ByVal . . .
    'TODO: This line of code loads data into the NameDataSet.qryName
    'My datasource for the custom dropdown
    Me.QryNameTableAdapter.Fill(Me.NameDataSet.qryName )

    For Each name As NameDataSet.qryNameRow In Me.NameDataSet.qryName
        aName.Add(name.LName)
    Next

Private Sub PositionDataGridView_EditingControlShowing(ByVal . . .
    Dim cbo As ComboBox
    If TypeOf e.Control Is ComboBox Then
        cbo = e.Control
        cbo.DropDownStyle = ComboBoxStyle.DropDown
        cbo.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        cbo.AutoCompleteSource = AutoCompleteSource.CustomSource
        cbo.AutoCompleteCustomSource = aName
    End If

pencilneck



pencilneck December 17th, 2007 03:08 PM

New problem:

Despite setting DropDownStyle = ComboBoxStyle.DropDown, it does not allow me to enter a value that is not contained in the list. (According to MS documentation, DropDownList limits entry to the list, while DropDown does not.)

Any suggestions?

pencilneck


Takeshi Okada May 9th, 2013 11:36 AM

Quote:

Originally Posted by pencilneck (Post 64622)
I want to use autocomplete in a texbox or combobox inside a datagridview, but AutoCompleteMode, AutoCompleteSource and AutoCompleteCustomSource properties are only available in the details combobox, not in the DataGridView.

Does anyone have an idea how to get around this? Maybe some code in the EditingControlShowing event or something?

Thanks in advance.
pencilneck

Hi!

You can get the help from following links. I hope it is very useful for developers related to "Autocomplete of Text In Datagridview".

http://www.mindstick.com/Articles/15...lete%20TextBox

http://www.vb-tips.com/DataGridViewAutoComplete.aspx

kerrymanam September 18th, 2014 04:49 AM

check this one....C# Autocomplete textbox in Datagridview

Kerry

Quote:

Originally Posted by pencilneck (Post 64622)
I want to use autocomplete in a texbox or combobox inside a datagridview, but AutoCompleteMode, AutoCompleteSource and AutoCompleteCustomSource properties are only available in the details combobox, not in the DataGridView.

Does anyone have an idea how to get around this? Maybe some code in the EditingControlShowing event or something?

Thanks in advance.
pencilneck


andersons July 21st, 2016 08:01 AM

I want to use autocomplete in a texbox or combobox inside a datagridview, but AutoCompleteMode, AutoCompleteSource and AutoCompleteCustomSource properties are only available in the details combobox, not in the DataGridView.


All times are GMT -4. The time now is 08:10 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.