Winforms VB.NET Replace text in databound ComboBox
Hi there
I'm wanting to replace some text in a DataBound ComboBox in a vb.net winform application.
The text I wish to replace is #ReplaceMe1 and #ReplaceMe5, depending on the number #ReplaceMe1 should be replaced with 'Replaced1' and 5 should be replaced with 'Replaced5'.
I am assuming I need to go through each item in the ComboBox with a 'For Each item...' loop but there doesn't seem to be a way to replace text in an ComboBox Item. Do I need to extract the item to a string, replace the text there and the put it back into the ComboBox? Or do I need to replace the text in the DataSet before I bind the data to the ComboBox?
Code example would be appreciated. I've put my code below so you can see whats happening.
Thanks in advance!
Public Sub BindComboData() Dim SelectedDate As String = EventDatePicker.Value.ToString Dim db As New EventsTATableAdapter Dim dt As New SASDBHandler.SASCustomerDataSet Dim ds As New DataSet() db.EventByDate(dt.EventsTA, SelectedDate) SelectEventComboBox.DataSource = dt.EventsTA SelectEventComboBox.DisplayMember = "EventData" SelectEventComboBox.ValueMember = "EventID"'Replace Text in ComboBox here? End Sub