Fastest way of filling a combobox from a datatable in VB.Net

后端 未结 4 1701
遇见更好的自我
遇见更好的自我 2021-01-21 18:38

The data table in the following code is filled with 7500-+ records. This all loads quickly from the server. The problem is that it takes a while to loop through the data rows to

4条回答
  •  死守一世寂寞
    2021-01-21 19:32

    You could also bind your ComboBox DataSource property to the DataTable. This has the added advantage of binding other column data (such as key values you might not want the user to see).

    You should be able to return a DataTable object from your SQLAdapter.

    cboColours.DataSource = dtColours
    cboColours.DisplayMember = dtColours.Columns("Colour").ToString
    cboColours.ValueMember = dtColours.Columns("Colour_id").ToString
    

提交回复
热议问题