I have written the code below to check and see if the text the user entered into the txtbox already exists as an item in a listbox before adding the new item. This works well; however, if say "Fish" exists in the listbox but the user entered "fish" in the textbox, the item is added to the listbox. I do not want this because the item already exists. How can I modify my code so that the comparison is not case sensitive? Any tips appreciated.
Code:'Check to make sure the active medication does not already exists in the list If lstActiveMeds.Items.Contains(strActiveMeds) = True Then MessageBox.Show("The active medication you entered has already been added to the list.", "Error") txtActiveMeds.Text = "" txtActiveMeds.Focus() Else 'Add the Active Medication to the list lstActiveMeds.Items.Add(strActiveMeds) txtActiveMeds.Text = "" txtActiveMeds.Focus() End If




Reply With Quote