0

I filled a combo box with a DataSource, everything works as intended but now I need clear each combo box. I cant use ComboBox.Items.Clear, since I get a error saying I cant modify a item collection when a DataSource property is established (translated)

ComboBox.Items.Clear Loop based on items.Count and remove x items

This is how I filled the combo box!

 Dim tabla_escenario_busqueda As New DataTable

        tabla_escenario_busqueda = Capa_de_Logica.BuscarInfoPP(txt_id_requerimiento_escenario_ver.Text) 'Llenar el combo Box
        txt_num_escenario_escenario_ver.DataSource = tabla_escenario_busqueda   'Se llena el combo box
        txt_num_escenario_escenario_ver.DisplayMember = "numero_escenario"
        'Fuente: https://stackoverflow.com/questions/17729770/how-do-i-bind-data-source-to-a-combobox
LarsTech
  • 80,625
  • 14
  • 153
  • 225
Jeremy
  • 1,447
  • 20
  • 40

1 Answers1

0

Damn, I feel so dumb hahaha, thanks to Steve, Jimi and LarsTech for the answers!

    txt_num_paso_escenario_ver.DataSource = Nothing
    txt_num_escenario_escenario_ver.DataSource = Nothing
Jeremy
  • 1,447
  • 20
  • 40