Results 1 to 2 of 2

Thread: checking if number in listbox

  1. #1
    genu is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Jun 2005
    Posts
    94
    Reputation
    100

    checking if number in listbox

    I have a listbox with phone numbers extracted from a website. but the list is populated with different characters that the program thinks that are potential phone numbers. the phone numbers in the list are in this format: "1231231234" how doI remove all the other items that dont have numberes in them?

  2. #2
    BadgerByte's Avatar
    BadgerByte is offline VB.NET Forum Genius
    .NET Framework
    .NET 1.1 (VS 2003)
    Join Date
    Aug 2005
    Location
    Ipswich, UK
    Posts
    194
    Reputation
    100
    Hi,

    No idea if this helps, this will totally remove any items that do not evaluate to numbers.

    dim lindex as integer

    For lindex = (ListBox1.Items.Count -1) to 0 step -1
    If Not IsNumeric(ListBox1.Items.Item(lindex)) Then

    ListBox1.Items.RemoveAt(lindex)

    End If

    Next

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking