VB.Net Populate Combobox From Datatable

How To Fill A Combobox Using A DataTable In Visual Basic.Net 

Populate Combobox From Datatable Using VB.Net

In This VB.Net Tutorial  We Will See How To Populate A ComboBox From DataTable In Form Load Using Visual Basic.Net Programming Language And Visual Studio Editor.


Project Source Code:

Public Class PopulateComboboxFromDatatable

    Private Sub PopulateComboboxFromDatatable_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim table As New DataTable()
        table.Columns.Add("id")
        table.Columns.Add("username")

        table.Rows.Add("1", "UN1")
        table.Rows.Add("2", "UN2")
        table.Rows.Add("3", "UN3")
        table.Rows.Add("4", "UN4")
        table.Rows.Add("5", "UN5")
        table.Rows.Add("6", "UN6")

        ComboBox1.DataSource = table
        ComboBox1.DisplayMember = "username"

    End Sub
End Class
      
///////////////OUTPUT:





filling combobx from datatable in vb.net




Share this

Related Posts

Previous
Next Post »