samedi 19 septembre 2015

How to make random image appear in a button in VB?

i made a simple game in VB The game goes like this: A random number between 1-10 appears on a textbox, there are 10 button underneath the thextbox. If for example, number 2 appears on the textbox, i quickly have to press number 2 button to gain a point before the number ranomizes again in the textbox. Hope you got how the game works now.

Anyway, for my question now, i changed the textbox to a button and changed all 10 buttons to images of my choice(all in resources). How do i make the main button randomize between the 10 images. just like how it works with 1-10 but with images.

I used this code for the 1-10 randomizer:

    RandomNumb = Int((10 * Rnd() + 1))
    TextBox1.Text = RandomNumb




Aucun commentaire:

Enregistrer un commentaire