Help - Search - Members - Calendar
Full Version: Find Duplicate Value
Pixel2Life Forum > Help Section > Desktop Programming
N-sane Noob
I have this one array and what I am trying to do is find after how many numbers is there a duplicate number. So if a list is:

5
4
6
3
5

Then it should display that the duplicate happens after 4 numbers.

Here's my code:

CODE
Option Explicit


Dim ind As Integer
Dim arrays() As Integer
Dim size As Integer
Dim i As Integer



Private Sub Form_Load()
Randomize
size = 5

ReDim arrays(size)
For ind = LBound(arrays) To UBound(arrays)
    arrays(ind) = Int(size * Rnd + 1)
        
Next ind


For ind = LBound(arrays) To UBound(arrays)
    List1.AddItem arrays(ind)
Next ind

End Sub
tjl30
What language is this? Basic?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.