In my Visual Basic program I'm just trying to find duplicate values entered into an array from an inputbox, but i can't seem to get the coding right on the final part to check for duplicate values already entered. Any help would be greatly appreciated. This is what i have so far except the code to check for duplicate values:
[CODE=vb]Dim intarray() As Integer
Dim intindex As Integer
Dim intcount As Integer
Dim intsearch As Integer
Dim intlow As Integer, inthigh As Integer
intlow = -32676
inthigh = 32676
ReDim intarray(intlow To inthigh)
For intindex = LBound(intarray ) To UBound(intarray )
Do
intnumber = InputBox("Enter a number:", "Enter number")
If intnumber < 1 Or intnumber > 99 Then
MsgBox "Please enter numbers only between 1 and 99"
End If
intarray(intind ex) = intnumber
intcount = intcount + 1
lstnums.AddItem intnumber
Loop Until 'duplicate is found
Next intindex
lbldisplay.Capt ion = "Duplicate number after " & intcount & " times."
End Sub[/CODE]
[CODE=vb]Dim intarray() As Integer
Dim intindex As Integer
Dim intcount As Integer
Dim intsearch As Integer
Dim intlow As Integer, inthigh As Integer
intlow = -32676
inthigh = 32676
ReDim intarray(intlow To inthigh)
For intindex = LBound(intarray ) To UBound(intarray )
Do
intnumber = InputBox("Enter a number:", "Enter number")
If intnumber < 1 Or intnumber > 99 Then
MsgBox "Please enter numbers only between 1 and 99"
End If
intarray(intind ex) = intnumber
intcount = intcount + 1
lstnums.AddItem intnumber
Loop Until 'duplicate is found
Next intindex
lbldisplay.Capt ion = "Duplicate number after " & intcount & " times."
End Sub[/CODE]
Comment