none
Insert database row into Combobox list

    Question

  • i just found this code it was really nice, as im just a beginner i can't solve it. when i execute the code the text inside the combobox is not my database but instead a text "System.Data.DataRowView" im really newbie in vb.net im really curious how will this work. thanks in advance :)
    Private Sub FillCombo()

    1. Try
    2. Dim fillcon As New OleDbConnection(conString)
    3. Dim asql As String = ("SELECT ItemName FROM ItemMaster ORDER BY ItemName")
    4. Dim da As New OleDbDataAdapter(asql, fillcon)
    5. Dim ds As New DataSet
    6. da.Fill(ds)
    7. ItemNameCombo.ValueMember = "ItemName"
    8. ItemNameCombo.DataSource = ds.Tables(0)
    9. ItemNameCombo.SelectedIndex = 0
    10. Catch ex As Exception
    11. MsgBox("ERROR : " & ex.Message.ToString)
    12. End Try
    13. End Sub

    Tuesday, October 01, 2013 8:07 AM

Answers