[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to check if a Listbox already contains a value?

Posted on 2008-10-07
3
Medium Priority
?
277 Views
Last Modified: 2013-11-26
Hi Guys

Just need a quick hint with fixing a Check for Listbox contains value statement.

The code below does not return my Msgbox as it should.

Dim MyService As New ListView
        MyService.Text = NewServiceTextBox.Text
        If ListBox12.Items.Contains(MyService.Text) = True Then
            MsgBox("Service Exists")
        End If

Open in new window

0
Comment
Question by:SasfinSD
  • 2
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22658543
use:
If not ListBox12.Items.FindByValue(MyService.Text) is Nothing) then

Open in new window

0
 

Accepted Solution

by:
SasfinSD earned 0 total points
ID: 22658636
I'm using Vs2008

FindbyValue is not a member of "System.Windows.Forms.ListBox.ObjectCollection

What now?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22658688
I see...
Dim MyService As New ListView
        MyService.Text = NewServiceTextBox.Text
        If ListBox12.Items.IndexOf(MyService.Text) >= 0 Then
            MsgBox("Service Exists")
        End If

Open in new window

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question