Cant increment an integer?

Hi guys, new to programming here so I was confused why my simple password app wasn’t working. The “badcount” integer is meant to go up by 1 each time but for some reason remains on 1 after every wrong password.


var badcount as Integer

if pwdbox.text = “hello” and badcount <3 then
msgbox “Correct!”
pwdbox.text = “”
badcount = badcount + 1
msgbox “Incorrect…”
pwdbox.text = “”
msgbox str (badcount)
end if

After each wrong password a msgbox appears with the value of “badcount”, but as I say it always remains on 1 rather than incrementing.

Anyone know why?


badcount is local (you declare it in you code) so every time you call this code it start from 0

put it in a property or declare it as static

Thanks very much!