using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DiceSimulator
{
    public partial class Form1 : Form
    {
        StandardDie die1, die2, die3, die4, die5;
        Random rand;
        public Form1()
        {
            InitializeComponent();
            rand = new Random();
        }
        /// <summary>
        /// This is the Event Handler for the Form's Load event.
        /// </summary>
        /// <param name="sender">The object that triggered the event (not used in this application)</param>
        /// <param name="e">The arguments associated with this event (not used in this application)</param>
        private void Form1_Load(object sender, EventArgs e)
        {
            die1 = new StandardDie(rand);
            die2 = new StandardDie(rand);
            die3 = new StandardDie(rand);
            die4 = new StandardDie(rand);
            die5 = new StandardDie(rand);
        }
        /// <summary>
        /// This is the Event Handler for the Roll Dice button's Click event.
        /// </summary>
        /// <param name="sender">The object that triggered the event (not used in this application)</param>
        /// <param name="e">The arguments associated with this event (not used in this application)</param>
        private void btnRollDice_Click(object sender, EventArgs e)
        {
            pictureBox1.Image = die1.Roll;
            pictureBox2.Image = die2.Roll;
            pictureBox3.Image = die3.Roll;
            pictureBox4.Image = die4.Roll;
            pictureBox5.Image = die5.Roll;
        }
        private void pictureBox3_Click(object sender, EventArgs e)
        {
        }
    }
}

I will try, my english is not good...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DiceSimulator
{
public partial class Form1 : Form
{
// Decleare 5 Object of StandartDie (die1,2,3,4,5)...
StandardDie die1, die2, die3, die4, die5;

// Decleare a rnd as Random
Random rand;

// Form Entry
public Form1()
{
  // Form Entry, when programs starts then will load InitializeCompoent()
  InitializeComponent();
  // Create a object in memory for variable rand
  rand = new Random();
}

// Event, called when form load
private void Form1_Load(object sender, EventArgs e)
{
// Here we have object wich are decleared up, i must see StandardDie code to say you what it do.
// i guess for object x you call a constructor "StandardDie" and you give a variable "rand????"
// i guess StandardDie takes a number, andyou want to give a random number but rand dont work like this
// take a example how Random works here -> http://msdn.microsoft.com/en-us/library/dwez734w.aspx
die1 = new StandardDie(rand);
die2 = new StandardDie(rand);
die3 = new StandardDie(rand);
die4 = new StandardDie(rand);
die5 = new StandardDie(rand);
}

// Event, called when you click button  "btnRollDice"
private void btnRollDice_Click(object sender, EventArgs e)
{
// There are 5 pictures in form, when you click button "btnRollDice" then pictures will take-change a image.
pictureBox1.Image = die1.Roll;
pictureBox2.Image = die2.Roll;
pictureBox3.Image = die3.Roll;
pictureBox4.Image = die4.Roll;
pictureBox5.Image = die5.Roll;
}

// Event for pictureBox3, when you click it.
private void pictureBox3_Click(object sender, EventArgs e)
{
    //nothing inside
}
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.