Jump to content


Photo

Find Duplicate Value


  • Please log in to reply
1 reply to this topic

#1 N-sane Noob

N-sane Noob

    Noob Leader

  • Publishing Betazoids
  • PipPipPip
  • 873 posts
  • Gender:Male
  • Location:Canada
  • Interests:Taking over stuff

Posted 16 March 2008 - 08:22 PM

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:

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


#2 tjl30

tjl30

    Young Padawan

  • Members
  • Pip
  • 67 posts
  • Gender:Male
  • Location:MA
  • Interests:Graphic Design, Website layouts, Website scripting, movie editing, animation, snowboarding, sculpture, and drawing.

Posted 04 April 2008 - 03:19 PM

What language is this? Basic?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users