Results 1 to 3 of 3

Thread: Duplicate entried in array

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    66

    Duplicate entried in array

    How do i compare a 9 digit number with all the rest of the elements in an array.


    I used a for...next loop to extract the .Substring(0,8)elements....now i want to produce an msg box if one is duplicated

  2. #2
    New Member
    Join Date
    Mar 2007
    Posts
    2

    Re: Duplicate entried in array

    Hi Kyle

    Use sorting and then doing loop :
    for idx = lbound(MyArr) + 1 to MyArr.length
    if MyArr(idx) = MyArr(Idx-1) then
    msgBox bla...bla...bla...
    end if
    next

    regards...

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    66

    Re: Duplicate entried in array

    vb Code:
    1. For index = LBound(Array) + 1 To Array.Length
    2.             If Array(index) = (Array(index - 1)) Then
    3.                 MsgBox("Error")
    4.                 End
    5.             End If

    that was my code......

    vb Code:
    1. 81908608    66
    2. 88884648    24
    3. 395880576   59
    4. 945064256   62
    5. 551614528   0
    6. 755506560   88
    7. 132684352   38


    and that is the array it is searching....why does it give me an rror every time....i want code to compare the array.substring(0,8) *the first 9 numbers in each line* and if = TextBox1.Text....i want TextBox2.Text to equal array.substring(9,2) *the last two digits*

Posting Permissions

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



Click Here to Expand Forum to Full Width