Hello,
I tried to insert a new value into the combobox which gave me the following error while executing the program.
Error: Can't modify the items collection when the datasource property is set.
Can you please tell me how to rectify and insert a blank value in the combobox
I tried to insert a new value into the combobox which gave me the following error while executing the program.
Error: Can't modify the items collection when the datasource property is set.
Can you please tell me how to rectify and insert a blank value in the combobox
Code:
Dim SQL As String, commission_dataset As DataSet
Dim commission_adapter As New System.Data.OleDb.OleDbDataAdapter()
SQL = "Select commission_id,commission_desc from sales_rep_comm"
commission_adapter = New System.Data.OleDb.OleDbDataAdapter(SQL, OleDbConnection2)
commission_dataset = New DataSet()
commission_adapter.Fill(commission_dataset, "sales_rep_comm")
Commission_based.DataSource() = commission_dataset.Tables("sales_rep_comm").DefaultView
Commission_based.ValueMember = commission_dataset.Tables("sales_rep_comm").Columns(0).ToString
Commission_based.DisplayMember = commission_dataset.Tables("sales_rep_comm").Columns(1).ToString
Commission_based.Items.Insert(0, " ")