I the Page_Load I have a random event and a public variable
Dim rndImage As Integer Randomize() rndImage = 1 + Int(Rnd() * 13) Select Case rndImage Case 1 ImageRnd.ImageUrl = "/jpro/images/rnd/Image1.gif" rndAnswer = "A7b" Case 2 ImageRnd.ImageUrl = "/jpro/images/rnd/Image2.gif" rndAnswer = "5RX" etc.... End Select
Then in the Button_Click event the string is to be compared with input from a textbox
If rndAnswer = Textbox1.text Then ' do events end if
To debug I output the value of both variables, and for some reason it looks like the program is going thru the Load event twice.
The output for the load event was
rndAnswer = "5RX"
But in the button event
rndAnswer = "A7b"
I thought maybe because PostBack is basically a page reload. Then I would add a boolean var to the load event:
If boolCheckPublic = false then ' do events boolCheckPublic = true End If
But that did not work.