Wednesday, July 5, 2017

load combobox | combo box

========== load combobox | combo box
 Sub load_combobox()
        Try
            If (con.State = ConnectionState.Open) Then
                con.Close()
            End If
            con.Open()

            cmd.Connection = con
            cmd.CommandText = "Select Model from tbCar"
            dr = cmd.ExecuteReader()
            Do While dr.Read = True
                cmbModel.Items.Add(dr.GetString(0).ToString())
            Loop
            con.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

=======================================

No comments:

Post a Comment