Live Chat Icon For mobile
Live Chat Icon

How to check if an item already exists in a listbox

Platform: ASP.NET| Category: ListBox


Dim lstitem As ListItem = ListBox1.Items.FindByValue('<valuecheckedfor>')
If Not lstitem Is Nothing Then
       Response.Write('Item Exists')
       Response.Write('Item Does not exist')
End If


ListItem lstitem    = ListBox1.Items.FindByValue('<valuecheckedfor>');
if (  lstitem !=null)
	Response.Write ('Does  exist');
	Response.Write ('Does not exist');

You can also use FindByText instead of FindByValue.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.