0

I have a textbox with a database table as an autocomplete source, I am filling the autocomplete string collection with the code below, it's working fine and suggestions are appearing as i type but this only suggests string which starts with what i'm typing, how can I get it to suggest strings that contains what i type.

Example, if I had a list of colors on my autocomplete and I type 'o' it would suggest colors like 'orange' but also 'violet'

oracmd = New OracleCommand("Select column_name from table", oracon)
Dim ds As New DataSet
orada = New OracleDataAdapter(oracmd)
orada.Fill(ds, "list")
Dim col As New AutoCompleteStringCollection
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1
     col.Add(ds.Tables(0).Rows(i)("column_name").ToString())
Next
TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
TextBox1.AutoCompleteCustomSource = col
TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest
crimson589
  • 1,238
  • 1
  • 20
  • 36
  • Possible duplicate of [WinForms | C# | AutoComplete in the Middle of a Textbox?](https://stackoverflow.com/questions/1437002/winforms-c-sharp-autocomplete-in-the-middle-of-a-textbox) – Sasha Sep 22 '17 at 10:50
  • @Jaxi i'm not sure if i did something wrong or not. I tried the answer on that question, I even downloaded the original source and it was only working like a normal autocomplete. I typed 'o' in the textbox and it gave me 'one' only and not other results like 'two' and 'four' – crimson589 Sep 22 '17 at 12:27
  • In PL/SQl; Select column_name from table where upper(column_name) like '%O%; – Prescott Chartier Sep 22 '17 at 19:36
  • @PrescottChartier I don't want to do that, I don't want to keep querying everytime the user types something, I just want get every possible data from the table, put it on a list or something and let the application handle the searching. – crimson589 Sep 22 '17 at 22:58

1 Answers1

0

You need to query the dataset or datatable using LIKE. For example:

GridView1.DataSource = ds.Select("column_name like  '%" & TextBox.Text & "%'")
Prescott Chartier
  • 1,519
  • 3
  • 17
  • 34