I'm having some trouble with catching duplicates in an assignment I'm working on.
The assignment is a track and field race manager. Times are read from a text file, a bib number is then entered for each time loaded from the text file (aka, however many rows there are in the time text file)
The bib numbers and times are then synced in the order from which they were entered. A requirement is that the Bib numbers must be entered one at a time using an input box. Every time a bib number is entered, it is loaded to a list box called lstBibs.
The Issue I have limited experience working with input boxes, and any attempts Ive made so far to check for duplicates has been ignored in Runtime. I'm also unsure where I would put a loop that checks for duplicates in the input box. Below is my code so far.
Dim i As Integer = 0 Dim Bibno As Integer = 0 Dim strrow As String = "" Dim count As Integer = 0 Dim errorCount1 As Integer = 0 'Reads through the number of rows in the Time Text File. 'The Number of rows we have in the text file corresponds to the number 'of bib numbers we need. Thus the input box will loop through bib 'numbers until 'we reach the amount of loaded times Try For Each item In lstTimeEntry.Items i += 1 For Bibno = 1 To i count += 1 Bibno = InputBox("Enter Bib #" & count) lstBibs.Items.Add(count & " - " & Bibno) btnSyncTimesBibs.Enabled = True Next Next Catch ex As Exception 'Catches any invalid data that isnt a number MsgBox("Invalid Input, Please Try Again", , "Error") lstBibs.Items.Clear() btnSyncTimesBibs.Enabled = False End Try
So I'm assuming that I must use a for loop that checks each list box item for a duplicate, I'm just unsure where this loop would go in relation to the code above.
Any and all help is very much appreciated. Thank you.