I have an app I am developing, and I wonder if I could get some help.
The purpose of the program is that at a meeting each of the clubs “bids” for championship classes for their show. There are two round of bidding. In the first round individual clubs can only receive a maximum of six championships. They can gain any number of extra championships in the second round. The selection of who gets the championship is by the random function.
As each club arrives at their sixth champion ship in the first round, I record their Club Number in an array. Then as the clubs enter their bids I check those entries again the maxClasses array, and remove any club number that has reach six. The algorithms I have seem to work most of the time, but “most” of the time is not good enough, obviously.
In the TextChange Event of the TextField that holds the number of championships gained, I check how many champs have already been gained as follows:
If App.RoundNum Then
me.changeColour(CDbl(me.Text))
End If
Here is my code for entering the club number into the maxClasses array and also changing their colour"
Dim checkNum as Double
Dim s As Integer
checkNum = Val(me.Text)
if checkNum >6 Then me.Text = "6"
Select case checkNum
case 5
me.TextColor = RGB(230,109,5)
case 6
me.TextColor = RGB(255,0,0)
s = Entry.receivingClub
roundPageMax.maxClasses.Append(s)
end Select
And here is the code for checking and deleting clubs already at six:
Dim s(), s1 As String
Dim i, j As Integer
s = split(selectedClubs, " ")
maxClasses.Sort
For j = 0 to UBound(maxClasses)
For i = UBound(s) DownTo 0
If Val(s(i)) = maxClasses(j) Then
s.Remove(i)
End If
Next
Next
s1 = Join(s, " ")
return s1
As I say, it works most of the time. I have tried to follow the flow of the program with the debugger, but I am not sure of the best way to do that, so I am missing when (or probably how) the error occurs.
It does occur to me that the error might be happening because the class in question is not being added to the maxClasses array soon enough, but I don’t really know how to make sure it is.
The TextFields for the 14 clubs are in a Set. I am already using the KeyDown Event to check that only numbers, spaces, and delete keys are entered. Obviously to do this I had to create a new class (which I called clubs). Can I use that class as one would a “created” class to let the individual fields do this checking for me. At present the checking is done in a module method.