Predmet:Re: Combobox as you type
Moja baza je MSSQL. Probao sam sa izmenama ali mi dozvoljava samo jedno slovo da upišem. Ali rezultata je dobar
*****
Private Sub nazivdm_combo_TextChanged(sender As Object, e As EventArgs) Handles nazivdm_combo.TextChanged
Dim strconn As String = "Data Source=10.10.60.83;Initial Catalog=INIT_DB;User ID=###;password=###"
Dim conn As New SqlConnection(strconn)
Dim cmd As New SqlCommand("SELECT Naziv FROM Kupci WHERE Naziv LIKE '%" & nazivdm_combo.Text & "%'", conn)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "List")
Dim col As New AutoCompleteStringCollection ' From which our names will come
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1
col.Add(ds.Tables(0).Rows(i)(0).ToString())
Next
'Dim rsArtikliBaraj = New ADODB.Recordset
'Dim dtArtikliBaraj As New DataTable
'Dim sqlBaraj As String
'Dim i As Integer
'sqlBaraj = "SELECT * FROM Kupci WHERE Naziv LIKE '%" & nazivdm_combo.Text & "%'"
'WHERE Description LIKE '%' + @SearchTerm + '%' AND Price <> '0.00'
'rsArtikliBaraj.Open(sqlBaraj, cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
'dtArtikliBaraj = RecordSetToDataTable(rsArtikliBaraj)
'txtFirstName.Text = ds.Tables("AddressBook").Rows(0).Item(1)
'Me.nazivdm_combo.DropDownStyle = ComboBoxStyle.DropDownList
'Me.nazivdm_combo.AutoCompleteMode = AutoCompleteMode.None
'Me.nazivdm_combo.AutoCompleteSource = AutoCompleteSource.None
' Me.cboArtikli.AllowDrop = True
Me.nazivdm_combo.DataSource = col
' Me.nazivdm_combo.DisplayMember = "Naziv"
' Me.nazivdm_combo.ValueMember = "ID"
'Me.nazivdm_combo.Refresh()
'Me.nazivdm_combo.DroppedDown = True
'Me.cboArtikli.DataBindings.Add("SelectedValue", dtArtikliBaraj, "Ed_Mera")
End Sub
****
Sigurno sam negde pogrešio