Fill a combox with DataReader

Hello. A question please. I know I can fill a combobox with a datatable, is there a way to fill it with the information of a Datareader

Answer this question

Fill a combox with DataReader

  • Alastair Q

    no, just 1 :-)

  • svarghese

    Hi NetPochi

    try this:

    While DataReader.Read
    ComboBox1.items.add(DataReader.GetValue(x).ToString)
    End While

    Dave

  • xuding

    Thanks. Another question can I choose more than 1 field for .displaymember property
  • xypher21

    just an alternative, if you are using a DataTable to fill your data with, why not set the DataSource and displaymember properties

    Me.theComboBox.DataSource = theDataTable.DefaultView

    Me.theComboBox.DisplayMember = "FieldNameToBindTo"



  • Fill a combox with DataReader