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 DiceRoll
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Random rand = new Random();
int randNumber = 0;
randNumber = (rand.Next(5)) + 1;
switch (randNumber)
{
case 1:
pictureBox1.Image = One.jpg;
break;
case 2:
pictureBox1.Image = Two.jpg;
break;
case 3:
pictureBox1.Image = Three.jpg;
break;
case 4:
pictureBox1.Image = Four.jpg;
break;
case 5:
pictureBox1.Image = Five.jpg;
break;
case 6:
pictureBox1.Image = Six.jpg;
break;
default:
MessageBox.Show("An error occured!");
break;
}
}
}
}
I followed the closest instructions I could find to add the images to the project, which was to Right-click >> ADD to the project >> Add existing >> then I selected the images and added them.
Any help would be greatly appreciated! Thank you :)


Sign In
Create Account


Back to top









