How to compare if combobox item is equal with listview item or listview already contains combobox item in c# -


How to compare or check whether the item in the combobox is already present in the list view or not? Please help ....

  if (lvCart.Items.ContainsKey (cmbdummy.SelectedItem.ToString ())) {MessageBox.Show ("Duplicate Entry!"); }  

You must check with the respective SelectedValue .

Try it:

  if (lvCart.Items.ContainsKey (cmbdummy.SelectedValue.ToString ()) {MessageBox.Show ("Duplicate Entry!"); }  

Comments

Popular posts from this blog

scala - Play Framework - how to bind form to a session field -

c++ - Why does Visual Studio Release build break on non-executing code line -

javascript - parsing json not working -