How To Fill A Combobox From MySQL DataBase In VbNet
In This VB.Net Tutorial We Will See How To Add Data From MySQL DataBase Into A Combobox Using DataTable In Visual Basic.Net Programming Language And Visual Studio Editor.
Project Source Code:
Imports MySql.Data.MySqlClient
Public Class Populate_Combobox_From_MySQL
Private Sub Populate_Combobox_From_MySQL_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim connection As New MySqlConnection("datasource=localhost;port=3306;username=root;password=")
Dim adapter As New MySqlDataAdapter("SELECT `Id`, `FullName`, `Address`, `BirthDate` FROM s_t_d.student", connection)
Dim table As New DataTable()
adapter.Fill(table)
ComboBox1.DataSource = table
ComboBox1.ValueMember = "Id"
ComboBox1.DisplayMember = "FullName"
End Sub
End Class
///////////////OUTPUT:
1 comments:
commentsHi! According to your project how can i Load fullname and Last Name into the Combobox?
Reply