Hello,
Looking for a bit of help and maybe one of you has a solution for my dilemma.
I have some dynamically created combobox controls and these have been assigned a data source along with a display member and a value member. I am able to add new items to the data source but haven't figured out a way to remove an item from the data source, which in turn removes it from the combobox. I can blank out the display member but that's it.
Here is a sample of what I've done so far:
Dim newCombo As ComboBox = Question
RemoveHandler newCombo.SelectedValueChanged, AddressOf RunRule
Dim newDataSource = newCombo.DataSource
Dim newDisplayMember = newCombo.DisplayMember
Dim newValueMember = newCombo.ValueMember
newCombo.DataSource = Nothing
For Each item In newDataSource
If item.AnswerName = ctlResult Then
item.AnswerName = String.Empty
End If
Next
newCombo.DataSource = newDataSource
newCombo.DisplayMember = newDisplayMember
newCombo.ValueMember = newValueMember
AddHandler newCombo.SelectedValueChanged, AddressOf RunRule
Thanks for any help provided.
Looking for a bit of help and maybe one of you has a solution for my dilemma.
I have some dynamically created combobox controls and these have been assigned a data source along with a display member and a value member. I am able to add new items to the data source but haven't figured out a way to remove an item from the data source, which in turn removes it from the combobox. I can blank out the display member but that's it.
Here is a sample of what I've done so far:
Dim newCombo As ComboBox = Question
RemoveHandler newCombo.SelectedValueChanged, AddressOf RunRule
Dim newDataSource = newCombo.DataSource
Dim newDisplayMember = newCombo.DisplayMember
Dim newValueMember = newCombo.ValueMember
newCombo.DataSource = Nothing
For Each item In newDataSource
If item.AnswerName = ctlResult Then
item.AnswerName = String.Empty
End If
Next
newCombo.DataSource = newDataSource
newCombo.DisplayMember = newDisplayMember
newCombo.ValueMember = newValueMember
AddHandler newCombo.SelectedValueChanged, AddressOf RunRule
Thanks for any help provided.