我读过的每一条评论都说这段代码有效..但是当我尝试在文本框中输入文本时,没有自动完成出现,它只是闪烁..请帮助,我是 winforms 新手
Private Sub txsCusID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txsCusID.TextChanged
Dim cmd As New SqlClient.SqlCommand("SELECT DISTINCT fname + ' ' + lname AS clist FROM tblclient WHERE id LIKE '%" + txsCusID.Text.ToString + "%'", sqlconstr)
Dim ds As New DataSet
Dim da As New SqlClient.SqlDataAdapter(cmd)
da.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)("clist").ToString())
Next
txsCusID.AutoCompleteSource = AutoCompleteSource.CustomSource
txsCusID.AutoCompleteCustomSource = col
txsCusID.AutoCompleteMode = AutoCompleteMode.Suggest
End Sub