variables - change random button text C# -
I'm trying to change my text to a random button based on the random number. I have tried the following code:
if (button (random int 1 to 9)). Lesson! = "X") {MessageBox.Show ("test work"); } How can I do this, but any input will be greatly appreciated.
You create a list of an array or button , and each button Add, and select a randomly, or name each button ButtonX , where X is the number then you can use it to select a button named after it.
Example:
random random = new random (); Button (as) Lesson! = "X") (MessageBox.Show ("Test worked");} Make sure you create a random example outside of a method, if If it is called many times, the result will not change.
Comments
Post a Comment