-1
我在寫文本框時使用此代碼來提示姓名。 當沒有更多的建議,我想展示一個新的表格,但我不知道如何計數建議itens。計算在VB.NET中的文本框中有多少建議
任何人都可以幫助我嗎?
在此先感謝並對我的英語感到抱歉。
If txt_nome.Text.Length >= 3 Then
Using con As NpgsqlConnection = GetConnection()
Dim sql As String
sql = "SELECT nome FROM dados_pessoais"
Dim cmd As NpgsqlCommand = New NpgsqlCommand(sql, con)
Dim da As NpgsqlDataAdapter = New NpgsqlDataAdapter(cmd)
Dim ds As New DataSet
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)("nome").ToString())
Next
txt_nome.AutoCompleteSource = AutoCompleteSource.CustomSource
txt_nome.AutoCompleteCustomSource = col
txt_nome.AutoCompleteMode = AutoCompleteMode.Suggest
End Using
End If
End Sub
'ds.Tables(0).Rows.Count'會給你你所需要的... – Codexer