Autocomplete of text in datagridview..

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 12022 Views - Last Post: 17 January 2015 - 09:24 AM Rate Topic: -----

#16 bradpitt1989  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-May 13

Re: Autocomplete of text in datagridview..

Posted 09 May 2013 - 07:19 AM

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...plete%20TextBox

http://www.vb-tips.c...toComplete.aspx
Was This Post Helpful? 0
  • +
  • -

#17 vks.gautam1  Icon User is offline

  • D.I.C Regular

Reputation: 17
  • View blog
  • Posts: 317
  • Joined: 21-March 08

Re: Autocomplete of text in datagridview..

Posted 09 May 2013 - 07:31 AM

View Postbradpitt1989, on 09 May 2013 - 07:19 AM, said:

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...plete%20TextBox

http://www.vb-tips.c...toComplete.aspx

thanks mate..
actually i want whole raw to move on with my type on datagridview..
right now im bz in other things in vb.net ..after some days i will continue to work on my task of moving all row with my type..i will continue this thread surely
Was This Post Helpful? 0
  • +
  • -

#18 ShadowProgrammer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-May 13

Re: Autocomplete of text in datagridview..

Posted 15 May 2013 - 11:54 AM

I'm trying to do pretty much the exact same thing as vks, get auto complete to work in a single column in my datagrid, but I'm still having problems even after trying everything suggested in the previous answers here.

I think my problem is that I'm using a datagrid in Virtual Mode, because when I create a brand new datagrid not in Virtual Mode and do the suggestions here it works fine. But when I try to implement auto complete in my virtual datagrid nothing appears to happen.

This my code right now to get auto complete working in column 16 (index 15).
    Private Sub DataGridAuditView_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) _
            Handles DataGridAuditView.EditingControlShowing
        If DataGridAuditView.CurrentCell.ColumnIndex = 15 Then 'Reviewer
            Dim lst As New List(Of String)

            Dim MySource As New AutoCompleteStringCollection()
            RunSQLiteCode("SELECT ALL FirstName, LastName FROM gblPersonnel", True, 1)
            While DSQLreader1.Read
                lst.Add(DSQLreader1("FirstName").ToString & " " & DSQLreader1("LastName").ToString)
            End While

            MySource.AddRange(lst.ToArray)
            Dim ReviewTextbox As TextBox = CType(e.Control, TextBox)
            ReviewTextbox.AutoCompleteCustomSource = MySource
            ReviewTextbox.AutoCompleteMode = AutoCompleteMode.SuggestAppend
            ReviewTextbox.AutoCompleteSource = AutoCompleteSource.CustomSource
        End If
    End Sub

I've thrown in breakpoints, and the sub Is running, and reading the data in from the database properly.

Anyone have any ideas what extra steps are needed to get auto complete to work in a virtual mode datagrid? I've been searching and reading through tutorials & guides for the last 3 hours with no luck at finding the answer.
Was This Post Helpful? 0
  • +
  • -

#19 Indudhar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-January 15

Re: Autocomplete of text in datagridview..

Posted 17 January 2015 - 09:24 AM

View PostCharlieMay, on 12 April 2013 - 07:24 AM, said:

OK, my code has a major issue. Once on, it will display for every textbox column and will probably crash if not a textbox column.

Try this instead:
    Private Sub DataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
        Dim ItemCode As TextBox = TryCast(e.Control, TextBox)
        If ItemCode IsNot Nothing Then
            If DataGridView1.CurrentCell.ColumnIndex = 1 Then
                ItemCode.AutoCompleteMode = AutoCompleteMode.SuggestAppend
                ItemCode.AutoCompleteCustomSource = xsource
                ItemCode.AutoCompleteSource = AutoCompleteSource.CustomSource
            Else
                'Not columnn 1, turn of Autocomplete
                ItemCode.AutoCompleteMode = AutoCompleteMode.None
            End If
        End If
    End Sub


thanks bro...this helped me
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2