download gratis video tutorial vb 6 dan vb.net plus contoh aplikasi

cara membuat autocomplete combobox dalam vb.net

 

 

Imports System.Data.SqlClient

 

Public Class autocompletecombobox

 

Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader

 

Sub Koneksi()
conn = New SqlConnection("data source=user-pc\sqlexpress;initial catalog=dbkas;integrated security=true")
conn.Open()
End Sub

 

Private Sub autocompletecombobox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Koneksi()
cmd = New SqlCommand("select keterangan from tblkas", conn)
dr = cmd.ExecuteReader
Do While dr.Read
ComboBox1.Items.Add(dr.Item(0)) 'keterangan
Loop
End Sub
End Class