lundi 4 septembre 2017

Need help making an image equal to a number C#

I have 5 random pictures change when clicked btnRoll (roll the dice) and have a guess btn (btnGuess) set up to where they can enter there guess on how much the dice total up to. So they put a number in the txtGuess and click btnGuess and it will display in the txtResult box if they are correct or not. I was told to set up an int that results the image equal to a number.

public partial class Form1 : Form
{
    int a = 0;
    public Form1()
    {
        InitializeComponent();
    }

    private void btnRoll_Click_1(object sender, EventArgs e)
    {
        Random random = new Random();
        picBx1.Image = imageList1.Images[random.Next(1, 6)];
        picBx2.Image = imageList1.Images[random.Next(1, 6)];
        picBx3.Image = imageList1.Images[random.Next(1, 6)];
        picBx4.Image = imageList1.Images[random.Next(1, 6)];

        a++;
        txtBxRolls.Text = a.ToString();
    }

    private void guessBx_TextChanged_1(object sender, EventArgs e)
    {
    }
}

It's been so long since I've messed around with any C#, so I don't remember much




Aucun commentaire:

Enregistrer un commentaire