Once a Combobox is bound to a datasource, we no longer have control over it’s List Collection, so we can’t add a blank item directly to the Combobox’s Collection using the Add Method.

However, we can temporariliy add a row having a blank value in the field bound to the Combobox’s DisplayMemebr property. We can then set the Selected index of the Combobox to that of the new “Blank” row…

dim drwBlankDataRow as DataRow


’ Databind Combobox

cmbComboBox.DataSource = dtsDataSet.tblTable
cmbComboBox.ValueMember = “ID_Column”
cmbComboBox.DisplayMember = “Display_Column”


’ Add a blank row to the DataSet

drwBlankDataRow = dtsDataSet.tblTable.NewRow
drwBlankDataRow(“Display_Column”) = “”
dtsDataSet.tblTable.AddtblTableRow(drwBlankDataRow)


’ Default the ComboBox to the Blank Row

cmbComboBox.SelectedIndex = cmbComboBox.FindStringExact(“”)

The Combobox will now show the new “Blank” row value.

By |2017-07-24T08:33:20+01:00November 26th, 2010|VB.net|0 Comments

About the Author:

Leave A Comment