Hello everyone.
Today’s lesson is about using the Rand() function in Alpha Software to generate the random numbers needed for our Powerball generator. Powerball rules are you need to pick 5 numbers from 1 to 59 for the white ping pong balls and pick one red ball number which ranges from 1 to 35. If you remember our form has 5 rows of choices and 5 columns of choices as well as 2 diagonal choices. This means each row, each column and each diagonal must have unique numbers in it.
To accomplish this we need to set a label, a variable, a text object and a numeric field for each ball. The label will be used as a goto for our code to set up a loop in the code to insure unique numbers. The variable allows for easier coding and faster processing as we generate the random numbers. The text object is set to oval and will be used as part of the process to identify matches in our number grid and finally the numeric fields will store our random generated numbers. Lets look at how it is done.
'Generate Random Numbers parentform.commit() rd1: v1 = round(Rand()*59,0) if v1 = 0 then goto rd1 end if rd2: v2 = round(Rand()*59,0) if v2 = 0 .or. v2 = v1 then goto rd2 end if rd3: v3 = round(Rand()*59,0) if v3 = 0 .or. v3 = v1 .or. v3 = v2 then goto rd3 end if rd4: v4 = round(Rand()*59,0) if v4 = 0 .or. v4 = v1 .or. v4 = v2 .or. v4 = v3 then goto rd4 end if rd5: v5 = round(Rand()*59,0) if v5 = 0 .or. v5 = v1 .or. v5 = v2 .or. v5 = v3 .or. v5 = v4 then goto rd5 end if rd6: v6 = round(Rand()*59,0) if v6 = 0 .or. v6 = v1 then goto rd6 end if rd7: v7 = round(Rand()*59,0) if v7 = 0 .or. v7 = v1 .or. v7 = v2 .or. v7 = v6 then goto rd7 end if rd8: v8 = round(Rand()*59,0) if v8 = 0 .or. v8 = v3 .or. v8 = v6 .or. v8 = v7 then goto rd8 end if rd9: v9 = round(Rand()*59,0) if v9 = 0 .or. v9 = v4 .or. v9 = v5 .or. v9 = v6 .or. v9 = v7 .or. v9 = v8 then goto rd9 end if rd10: v10 = round(Rand()*59,0) if v10 = 0 .or. v10 = v5 .or. v10 = v6 .or. v10 = v7 .or. v10 = v8 .or. v10 = v9 then goto rd10 end if rd11: v11 = round(Rand()*59,0) if v11 = 0 .or. v11 = v1 .or. v11 = v6 then goto rd11 end if rd12: v12 = round(Rand()*59,0) if v12 = 0 .or. v12 = v2 .or. v12 = v7 .or. v12 = v11 then goto rd12 end if rd13: v13 = round(Rand()*59,0) if v13 = 0 .or. v13 = v1 .or. v13 = v3 .or. v13 = v5 .or. v13 = v7 .or. v13 = v8 .or. v13 = v9 .or. v13 = v11 .or. v13 = v12 then goto rd13 end if rd14: v14 = round(Rand()*59,0) if v14 = 0 .or. v14 = v4 .or. v14 = v9 .or. v14 = v11 .or.v14 = v12 .or. v14 = v13 then goto rd14 end if rd15: v15 = round(Rand()*59,0) if v15 = 0 .or. v15 = v5 .or. v15 = v10 .or. v15 = v11 .or.v15 = v12 .or. v15 = v13 .or. v15 = v14 then goto rd15 end if rd16: v16 = round(Rand()*59,0) if v16 = 0 .or. v16 = v1 .or. v16 = v6 .or. v16 = v11 then goto rd16 end if rd17: v17 = round(Rand()*59,0) if v17 = 0 .or. v17 = v2 .or. v17 = v5 .or. v17 = v9 .or. v17 = v12 .or. v17 = v13 .or. v17 = v16 then goto rd17 end if rd18: v18 = round(Rand()*59,0) if v18 = 0 .or. v18 = v3 .or. v18 = v8 .or. v18 = v13 .or. v18 = v16 .or. v18 = v17 then goto rd18 end if rd19: v19 = round(Rand()*59,0) if v19 = 0 .or. v19 = v1 .or. v19 = v4 .or. v19 = v7 .or. v19 = v13 .or. v19 = v14 .or. v19 = v16 .or. v19 = v17 .or. v19 = v18 then goto rd19 end if rd20: v20 = round(Rand()*59,0) if v20 = 0 .or. v20 = v5 .or. v20 = v10 .or. v20 = v15 .or. v20 = v16 .or. v20 = v17 .or. v20 = v18 .or. v20 = v19 then goto rd20 end if rd21: v21 = round(Rand()*59,0) if v21 = 0 .or. v21 = v1 .or. v21 = v5 .or. v21 = v6 .or. v21 = v9 .or. v21 = v11 .or. v21 = v13 .or. v21 = v16 .or. v21 = v17 then goto rd21 end if rd22: v22 = round(Rand()*59,0) if v22 = 0 .or. v22 = v2 .or. v22 = v7 .or. v22 = v12.or. v22 = v17 then goto rd22 end if rd23: v23 = round(Rand()*59,0) if v23 = 0 .or. v23 = v3 .or. v23 = v8 .or. v23 = v13.or. v23 = v18 then goto rd23 end if rd24: v24 = round(Rand()*59,0) if v24 = 0 .or. v24 = v4 .or. v24 = v9 .or. v24 = v14.or. v24 = v19 then goto rd24 end if rd25: v25 = round(Rand()*59,0) if v25 = 0 .or. v25 = v1 .or. v25 = v5 .or. v25 = v7 .or. v25 = v10 .or. v25 = v13 .or. v25 = v15 .or. v25 = v19 .or. v25 = v20 .or. v25 = v21 .or. v25 = v22 .or. v25 = v23 .or. v25 = v24 then goto rd21 end if
The Alpha Software function
Rand()
always returns the same value when run so it need a multiplier value to generate unique values. For the white ping pong balls we use
round(rand(*59,0).
This will generate random values from 0 to 59 however the values can repeat. So we need to have a process in our code to eliminate the zero and any duplicate values for each row, column and diagonal. We do this with the loop code
rd1:
v1 = round(rand(*59,0)
if v1 = 0 then
goto rd1
end if
The code above is for the white ball number 1 and states if the random number generated for variable v1 = 0 then goto the label rd1 and rerun the code. This is a simple way to process the code in a loop until we get a unique value from 1 to 59 for our first ping pong ball. This same process is used to also insure each row, column and diagonal is unique.
For the Red ball we do the same but the random multiplier is only 35.
'Generate Red Ball Random Numbers rdrb1: rb1 = round(Rand()*35,0) if rb1 = 0 then goto rdrb1 end if rdrb2: rb2 = round(Rand()*35,0) if rb2 = 0 then goto rdrb2 end if rdrb3: rb3 = round(Rand()*35,0) if rb3 = 0 then goto rdrb3 end if rdrb4: rb4 = round(Rand()*35,0) if rb4 = 0 then goto rdrb4 end if rdrb5: rb5 = round(Rand()*35,0) if rb5 = 0 then goto rdrb5 end if rdrb6: rb6 = round(Rand()*35,0) if rb6 = 0 then goto rdrb6 end if rdrb7: rb7 = round(Rand()*35,0) if rb7 = 0 then goto rdrb7 end if rdrb8: rb8 = round(Rand()*35,0) if rb8 = 0 then goto rdrb8 end if rdrb9: rb9 = round(Rand()*35,0) if rb9 = 0 then goto rdrb9 end if rdrb10: rb10 = round(Rand()*35,0) if rb10 = 0 then goto rdrb10 end if rdrb11: rb11 = round(Rand()*35,0) if rb11 = 0 then goto rdrb11 end if rdrb12: rb12 = round(Rand()*35,0) if rb12 = 0 then goto rdrb12 end if
Since only one red ball is chosen for each group of numbers, we only need concern ourselves with the zero.
Once we have our values we need to assign them to our fields. I do this by setting the text value for each field to the proper variable.
'Assign Random Numbers to White Balls NbrPicker:pb_1_1.text = str(v1) NbrPicker:pb_1_2.text = str(v2) NbrPicker:pb_1_3.text = str(v3) NbrPicker:pb_1_4.text = str(v4) NbrPicker:pb_1_5.text = str(v5) NbrPicker:pb_2_1.text = str(v6) NbrPicker:pb_2_2.text = str(v7) NbrPicker:pb_2_3.text = str(v8) NbrPicker:pb_2_4.text = str(v9) NbrPicker:pb_2_5.text = str(v10) NbrPicker:pb_3_1.text = str(v11) NbrPicker:pb_3_2.text = str(v12) NbrPicker:pb_3_3.text = str(v13) NbrPicker:pb_3_4.text = str(v14) NbrPicker:pb_3_5.text = str(v15) NbrPicker:pb_4_1.text = str(v16) NbrPicker:pb_4_2.text = str(v17) NbrPicker:pb_4_3.text = str(v18) NbrPicker:pb_4_4.text = str(v19) NbrPicker:pb_4_5.text = str(v20) NbrPicker:pb_5_1.text = str(v21) NbrPicker:pb_5_2.text = str(v22) NbrPicker:pb_5_3.text = str(v23) NbrPicker:pb_5_4.text = str(v24) NbrPicker:pb_5_5.text = str(v25) 'Assign Random Numbers to Red Balls NbrPicker:pb_6_1.text = str(rb1) NbrPicker:pb_6_2.text = str(rb2) NbrPicker:pb_6_3.text = str(rb3) NbrPicker:pb_6_4.text = str(rb4) NbrPicker:pb_6_5.text = str(rb5) NbrPicker:pb_6_6.text = str(rb6) NbrPicker:pb_6_7.text = str(rb7) NbrPicker:pb_6_8.text = str(rb8) NbrPicker:pb_6_9.text = str(rb9) NbrPicker:pb_6_10.text = str(rb10) NbrPicker:pb_6_11.text = str(rb11) NbrPicker:pb_6_12.text = str(rb12)
As explained in the xBasic lessons I am assigning the text property values for the form objects using explicit code.
The last thing to do is to check to see if any matches exist with the actual numbers drawn for the powerball date.
'Find Matches White Balls if NbrPicker:pb_1_1.text = NbrPicker:act_1.text .or. NbrPicker:pb_1_1.text = NbrPicker:act_2.text .or. NbrPicker:pb_1_1.text = NbrPicker:act_3.text .or. NbrPicker:pb_1_1.text = NbrPicker:act_4.text .or. NbrPicker:pb_1_1.text = NbrPicker:act_5.text then :NbrPicker:Text1.Fill.Color = "Pale Blue" else :NbrPicker:Text1.Fill.Color = "Dirty White" end if if NbrPicker:pb_1_2.text = NbrPicker:act_1.text .or. NbrPicker:pb_1_2.text = NbrPicker:act_2.text .or. NbrPicker:pb_1_2.text = NbrPicker:act_3.text .or. NbrPicker:pb_1_2.text = NbrPicker:act_4.text .or. NbrPicker:pb_1_2.text = NbrPicker:act_5.text then :NbrPicker:Text2.Fill.Color = "Pale Blue" else :NbrPicker:Text2.Fill.Color = "Dirty White" end if if NbrPicker:pb_1_3.text = NbrPicker:act_1.text .or. NbrPicker:pb_1_3.text = NbrPicker:act_2.text .or. NbrPicker:pb_1_3.text = NbrPicker:act_3.text .or. NbrPicker:pb_1_3.text = NbrPicker:act_4.text .or. NbrPicker:pb_1_3.text = NbrPicker:act_5.text then :NbrPicker:Text3.Fill.Color = "Pale Blue" else :NbrPicker:Text3.Fill.Color = "Dirty White" end if if NbrPicker:pb_1_4.text = NbrPicker:act_1.text .or. NbrPicker:pb_1_4.text = NbrPicker:act_2.text .or. NbrPicker:pb_1_4.text = NbrPicker:act_3.text .or. NbrPicker:pb_1_4.text = NbrPicker:act_4.text .or. NbrPicker:pb_1_4.text = NbrPicker:act_5.text then :NbrPicker:Text4.Fill.Color = "Pale Blue" else :NbrPicker:Text4.Fill.Color = "Dirty White" end if if NbrPicker:pb_1_5.text = NbrPicker:act_1.text .or. NbrPicker:pb_1_5.text = NbrPicker:act_2.text .or. NbrPicker:pb_1_5.text = NbrPicker:act_3.text .or. NbrPicker:pb_1_5.text = NbrPicker:act_4.text .or. NbrPicker:pb_1_5.text = NbrPicker:act_5.text then :NbrPicker:Text5.Fill.Color = "Pale Blue" else :NbrPicker:Text5.Fill.Color = "Dirty White" end if if NbrPicker:pb_2_1.text = NbrPicker:act_1.text .or. NbrPicker:pb_2_1.text = NbrPicker:act_2.text .or. NbrPicker:pb_2_1.text = NbrPicker:act_3.text .or. NbrPicker:pb_2_1.text = NbrPicker:act_4.text .or. NbrPicker:pb_2_1.text = NbrPicker:act_5.text then :NbrPicker:Text7.Fill.Color = "Pale Blue" else :NbrPicker:Text7.Fill.Color = "Dirty White" end if if NbrPicker:pb_2_2.text = NbrPicker:act_1.text .or. NbrPicker:pb_2_2.text = NbrPicker:act_2.text .or. NbrPicker:pb_2_2.text = NbrPicker:act_3.text .or. NbrPicker:pb_2_2.text = NbrPicker:act_4.text .or. NbrPicker:pb_2_2.text = NbrPicker:act_5.text then :NbrPicker:Text8.Fill.Color = "Pale Blue" else :NbrPicker:Text8.Fill.Color = "Dirty White" end if if NbrPicker:pb_2_3.text = NbrPicker:act_1.text .or. NbrPicker:pb_2_3.text = NbrPicker:act_2.text .or. NbrPicker:pb_2_3.text = NbrPicker:act_3.text .or. NbrPicker:pb_2_3.text = NbrPicker:act_4.text .or. NbrPicker:pb_2_3.text = NbrPicker:act_5.text then :NbrPicker:Text9.Fill.Color = "Pale Blue" else :NbrPicker:Text9.Fill.Color = "Dirty White" end if if NbrPicker:pb_2_4.text = NbrPicker:act_1.text .or. NbrPicker:pb_2_4.text = NbrPicker:act_2.text .or. NbrPicker:pb_2_4.text = NbrPicker:act_3.text .or. NbrPicker:pb_2_4.text = NbrPicker:act_4.text .or. NbrPicker:pb_2_4.text = NbrPicker:act_5.text then :NbrPicker:Text10.Fill.Color = "Pale Blue" else :NbrPicker:Text10.Fill.Color = "Dirty White" end if if NbrPicker:pb_2_5.text = NbrPicker:act_1.text .or. NbrPicker:pb_2_5.text = NbrPicker:act_2.text .or. NbrPicker:pb_2_5.text = NbrPicker:act_3.text .or. NbrPicker:pb_2_5.text = NbrPicker:act_4.text .or. NbrPicker:pb_2_5.text = NbrPicker:act_5.text then :NbrPicker:Text11.Fill.Color = "Pale Blue" else :NbrPicker:Text11.Fill.Color = "Dirty White" end if if NbrPicker:pb_3_1.text = NbrPicker:act_1.text .or. NbrPicker:pb_3_1.text = NbrPicker:act_2.text .or. NbrPicker:pb_3_1.text = NbrPicker:act_3.text .or. NbrPicker:pb_3_1.text = NbrPicker:act_4.text .or. NbrPicker:pb_3_1.text = NbrPicker:act_5.text then :NbrPicker:Text13.Fill.Color = "Pale Blue" else :NbrPicker:Text13.Fill.Color = "Dirty White" end if if NbrPicker:pb_3_2.text = NbrPicker:act_1.text .or. NbrPicker:pb_3_2.text = NbrPicker:act_2.text .or. NbrPicker:pb_3_2.text = NbrPicker:act_3.text .or. NbrPicker:pb_3_2.text = NbrPicker:act_4.text .or. NbrPicker:pb_3_2.text = NbrPicker:act_5.text then :NbrPicker:Text14.Fill.Color = "Pale Blue" else :NbrPicker:Text14.Fill.Color = "Dirty White" end if if NbrPicker:pb_3_3.text = NbrPicker:act_1.text .or. NbrPicker:pb_3_3.text = NbrPicker:act_2.text .or. NbrPicker:pb_3_3.text = NbrPicker:act_3.text .or. NbrPicker:pb_3_3.text = NbrPicker:act_4.text .or. NbrPicker:pb_3_3.text = NbrPicker:act_5.text then :NbrPicker:Text15.Fill.Color = "Pale Blue" else :NbrPicker:Text15.Fill.Color = "Dirty White" end if if NbrPicker:pb_3_4.text = NbrPicker:act_1.text .or. NbrPicker:pb_3_4.text = NbrPicker:act_2.text .or. NbrPicker:pb_3_4.text = NbrPicker:act_3.text .or. NbrPicker:pb_3_4.text = NbrPicker:act_4.text .or. NbrPicker:pb_3_4.text = NbrPicker:act_5.text then :NbrPicker:Text16.Fill.Color = "Pale Blue" else :NbrPicker:Text16.Fill.Color = "Dirty White" end if if NbrPicker:pb_3_5.text = NbrPicker:act_1.text .or. NbrPicker:pb_3_5.text = NbrPicker:act_2.text .or. NbrPicker:pb_3_5.text = NbrPicker:act_3.text .or. NbrPicker:pb_3_5.text = NbrPicker:act_4.text .or. NbrPicker:pb_3_5.text = NbrPicker:act_5.text then :NbrPicker:Text17.Fill.Color = "Pale Blue" else :NbrPicker:Text17.Fill.Color = "Dirty White" end if if NbrPicker:pb_4_1.text = NbrPicker:act_1.text .or. NbrPicker:pb_4_1.text = NbrPicker:act_2.text .or. NbrPicker:pb_4_1.text = NbrPicker:act_3.text .or. NbrPicker:pb_4_1.text = NbrPicker:act_4.text .or. NbrPicker:pb_4_1.text = NbrPicker:act_5.text then :NbrPicker:Text19.Fill.Color = "Pale Blue" else :NbrPicker:Text19.Fill.Color = "Dirty White" end if if NbrPicker:pb_4_2.text = NbrPicker:act_1.text .or. NbrPicker:pb_4_2.text = NbrPicker:act_2.text .or. NbrPicker:pb_4_2.text = NbrPicker:act_3.text .or. NbrPicker:pb_4_2.text = NbrPicker:act_4.text .or. NbrPicker:pb_4_2.text = NbrPicker:act_5.text then :NbrPicker:Text20.Fill.Color = "Pale Blue" else :NbrPicker:Text20.Fill.Color = "Dirty White" end if if NbrPicker:pb_4_3.text = NbrPicker:act_1.text .or. NbrPicker:pb_4_3.text = NbrPicker:act_2.text .or. NbrPicker:pb_4_3.text = NbrPicker:act_3.text .or. NbrPicker:pb_4_3.text = NbrPicker:act_4.text .or. NbrPicker:pb_4_3.text = NbrPicker:act_5.text then :NbrPicker:Text21.Fill.Color = "Pale Blue" else :NbrPicker:Text21.Fill.Color = "Dirty White" end if if NbrPicker:pb_4_4.text = NbrPicker:act_1.text .or. NbrPicker:pb_4_4.text = NbrPicker:act_2.text .or. NbrPicker:pb_4_4.text = NbrPicker:act_3.text .or. NbrPicker:pb_4_4.text = NbrPicker:act_4.text .or. NbrPicker:pb_4_4.text = NbrPicker:act_5.text then :NbrPicker:Text22.Fill.Color = "Pale Blue" else :NbrPicker:Text22.Fill.Color = "Dirty White" end if if NbrPicker:pb_4_5.text = NbrPicker:act_1.text .or. NbrPicker:pb_4_5.text = NbrPicker:act_2.text .or. NbrPicker:pb_4_5.text = NbrPicker:act_3.text .or. NbrPicker:pb_4_5.text = NbrPicker:act_4.text .or. NbrPicker:pb_4_5.text = NbrPicker:act_5.text then :NbrPicker:Text23.Fill.Color = "Pale Blue" else :NbrPicker:Text23.Fill.Color = "Dirty White" end if if NbrPicker:pb_5_1.text = NbrPicker:act_1.text .or. NbrPicker:pb_5_1.text = NbrPicker:act_2.text .or. NbrPicker:pb_5_1.text = NbrPicker:act_3.text .or. NbrPicker:pb_5_1.text = NbrPicker:act_4.text .or. NbrPicker:pb_5_1.text = NbrPicker:act_5.text then :NbrPicker:Text25.Fill.Color = "Pale Blue" else :NbrPicker:Text25.Fill.Color = "Dirty White" end if if NbrPicker:pb_5_2.text = NbrPicker:act_1.text .or. NbrPicker:pb_5_2.text = NbrPicker:act_2.text .or. NbrPicker:pb_5_2.text = NbrPicker:act_3.text .or. NbrPicker:pb_5_2.text = NbrPicker:act_4.text .or. NbrPicker:pb_5_2.text = NbrPicker:act_5.text then :NbrPicker:Text26.Fill.Color = "Pale Blue" else :NbrPicker:Text26.Fill.Color = "Dirty White" end if if NbrPicker:pb_5_3.text = NbrPicker:act_1.text .or. NbrPicker:pb_5_3.text = NbrPicker:act_2.text .or. NbrPicker:pb_5_3.text = NbrPicker:act_3.text .or. NbrPicker:pb_5_3.text = NbrPicker:act_4.text .or. NbrPicker:pb_5_3.text = NbrPicker:act_5.text then :NbrPicker:Text27.Fill.Color = "Pale Blue" else :NbrPicker:Text27.Fill.Color = "Dirty White" end if if NbrPicker:pb_5_4.text = NbrPicker:act_1.text .or. NbrPicker:pb_5_4.text = NbrPicker:act_2.text .or. NbrPicker:pb_5_4.text = NbrPicker:act_3.text .or. NbrPicker:pb_5_4.text = NbrPicker:act_4.text .or. NbrPicker:pb_5_4.text = NbrPicker:act_5.text then :NbrPicker:Text28.Fill.Color = "Pale Blue" else :NbrPicker:Text28.Fill.Color = "Dirty White" end if if NbrPicker:pb_5_5.text = NbrPicker:act_1.text .or. NbrPicker:pb_5_5.text = NbrPicker:act_2.text .or. NbrPicker:pb_5_5.text = NbrPicker:act_3.text .or. NbrPicker:pb_5_5.text = NbrPicker:act_4.text .or. NbrPicker:pb_5_5.text = NbrPicker:act_5.text then :NbrPicker:Text29.Fill.Color = "Pale Blue" else :NbrPicker:Text29.Fill.Color = "Dirty White" end if 'Find Matches Red Balls if NbrPicker:pb_6_1.text = NbrPicker:act_pb_6.text then :NbrPicker:Text6.Fill.Accent_Color = "Tan" else :NbrPicker:Text6.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_2.text = NbrPicker:act_pb_6.text then :NbrPicker:Text12.Fill.Accent_Color = "Tan" else :NbrPicker:Text12.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_3.text = NbrPicker:act_pb_6.text then :NbrPicker:Text18.Fill.Accent_Color = "Tan" else :NbrPicker:Text18.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_4.text = NbrPicker:act_pb_6.text then :NbrPicker:Text24.Fill.Accent_Color = "Tan" else :NbrPicker:Text24.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_5.text = NbrPicker:act_pb_6.text then :NbrPicker:Text30.Fill.Accent_Color = "Tan" else :NbrPicker:Text30.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_6.text = NbrPicker:act_pb_6.text then :NbrPicker:Text31.Fill.Accent_Color = "Tan" else :NbrPicker:Text31.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_7.text = NbrPicker:act_pb_6.text then :NbrPicker:Text32.Fill.Accent_Color = "Tan" else :NbrPicker:Text32.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_8.text = NbrPicker:act_pb_6.text then :NbrPicker:Text46.Fill.Accent_Color = "Tan" else :NbrPicker:Text46.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_9.text = NbrPicker:act_pb_6.text then :NbrPicker:Text47.Fill.Accent_Color = "Tan" else :NbrPicker:Text47.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_10.text = NbrPicker:act_pb_6.text then :NbrPicker:Text44.Fill.Accent_Color = "Tan" else :NbrPicker:Text44.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_11.text = NbrPicker:act_pb_6.text then :NbrPicker:Text45.Fill.Accent_Color = "Tan" else :NbrPicker:Text45.Fill.Accent_Color = "Red" end if if NbrPicker:pb_6_12.text = NbrPicker:act_pb_6.text then :NbrPicker:Text43.Fill.Accent_Color = "Tan" else :NbrPicker:Text43.Fill.Accent_Color = "Red" end if
Again notice I am using the explicit method to compare the text properties of two form objects and if they match, I set the fill color to pale blue for the white balls and the accent color to tan for the red balls. Also notice the white balls need to check for a match for each of the five acutal drawn numbers and the red balls only need to match ball six.
Our next lesson will look at the analyzer form and how to perform list processing to find matches in a large list of values.
Well that’s it for today. I hope you found this lesson helpful. Remember, if you need help with an Alpha Software application or wish to inquire about a custom application for your business go to our website
and inquire or contact
NLawson@cdc-TakeCharge.com
Have a great day.

Leave a comment