I am stuck on Visual Basic problem regarding combo boxes. The question states:
Assume that the Simple combo box appears as shown and that the Sorted property is set to True. Give a statement or statements that will carry out the stated task.
The combo box contains:
Delete every item beginning with the letter M. (The code should do the job even if additional items were added to the list.)
I tried just to get it to search first. This code does that, but it only searches the combo box for soley the letter M. Since I don't know how to delete the name from the combo box once it is found, I just put message boxes there. Is there a line of code that would delete the item once it was found? How do I have it search and then delete an item based on its first letter?
Private Sub btnM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnM.Click
Dim found As Boolean = False
For i As Integer = 0 To cboBox.Items.Count - 1
If (cboBox.Items.Contains("M")) Then
found = True
If found Then
MsgBox("M is in the list.")
MsgBox("M not found.")