Dim lst As New List(Of String)
Dim MySource As New AutoCompleteStringCollection()
Dim dt As New DataTable
Dim sql As String = "select MSGGID from tbt_msg " '' Query data from tbt_msg
dt = ssCON.Exc_Reader(sql) '' ssCON.Exc_Reader --> เปลี่ยนเป็น ExecuteNonQuery()
If dt.Rows.Count > 0 Then
For i As Integer = 0 To dt.Rows.Count - 1
lst.Add(dt.Rows(i)("MSGGID").ToString) 'MsgBox(dr(0)("EMSGEN").ToString) '' ADD ข้อมูลจาก DB
Next
End If
'' ADD ข้อมูลจาก Manual
lst.Add("apple")
lst.Add("applle")
lst.Add("appple")
lst.Add("appplee")
lst.Add("bear")
lst.Add("pear33")
MySource.AddRange(lst.ToArray)
TextBox1.AutoCompleteCustomSource = MySource
TextBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource