if statement for comparing picturebox1.image &&. . . .
hi! first of all i am a total newbie at c#.. well at programming at least.. and it is a subject at my college.( But im taking BSBA) any way my project was to create a slot machine or something that resembles a slot machine. the only problem i am facing is that i cant think of a way to compare each picture box. what i had in mind is for example when pic1.image is 0.jpg and pic2 and pic3 are also 0.jpg it will display a messagebox saying you gained let say 2coin. but when pic1.image is 1.jpg and pic2 andpic3 are also 1.jpg, it will display a different messagebox saying u gained let say 3 coin. sorry for my bad explanation but i hope you can understand my problem. this is Visual C#. i will copy paste my code so hopefully you can understand what im trying to say\
<code>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Resources;
namespace Project_final
{
public partial class Form1 : Form
{
Random r = new Random();
string path = @"C:\\Users\KiDkArDeL\Desktop\pikapika\";
List<int> RemainNums;
List<int> RemainNums2;
List<int> RemainNums3;
int ARandomNumber;
int ARandomNumber2;
int ARandomNumber3;
public Form1()
{
InitializeComponent();
}
private void SLOTMECH_Tick(object sender, EventArgs e)
{
if (SLOTMECH.Interval > 26)
{
SLOTMECH.Interval = SLOTMECH.Interval -25;
}
else {
SLOTMECH.Interval = 1;
}
RemainNums = new List<int>();
RemainNums.AddRange(new int[] { 0,1,2,3,4 });
RemainNums2 = new List<int>();
RemainNums2.AddRange(new int[] { 1,4,0,2,3 });
RemainNums3 = new List<int>();
RemainNums3.AddRange(new int[] { 3,4,1,2,0 });
int index = r.Next(0, RemainNums.Count - 1);
ARandomNumber = RemainNums[index];
RemainNums.RemoveAt(index);
ARandomNumber2 = RemainNums2[index];
RemainNums2.RemoveAt(index);
pic1.Image = Image.FromFile(path + ARandomNumber + ".jpg");
index = r.Next(0, RemainNums.Count - 1);
ARandomNumber = RemainNums[index];
RemainNums.RemoveAt(index);
pic4.Image = Image.FromFile(path + ARandomNumber + ".jpg");
index = r.Next(0, RemainNums.Count - 1);
ARandomNumber = RemainNums[index];
RemainNums.RemoveAt(index);
pic7.Image = Image.FromFile(path + ARandomNumber + ".jpg");
pic2.Image = Image.FromFile(path + ARandomNumber2 + ".jpg");
index = r.Next(0, RemainNums2.Count - 1);
ARandomNumber2 = RemainNums2[index];
RemainNums2.RemoveAt(index);
pic5.Image = Image.FromFile(path + ARandomNumber2 + ".jpg");
index = r.Next(0, RemainNums2.Count - 1);
ARandomNumber2 = RemainNums2[index];
RemainNums2.RemoveAt(index);
pic8.Image = Image.FromFile(path + ARandomNumber2 + ".jpg");
ARandomNumber3 = RemainNums3[index];
RemainNums3.RemoveAt(index);
pic3.Image = Image.FromFile(path + ARandomNumber3 + ".jpg");
index = r.Next(0, RemainNums3.Count - 1);
ARandomNumber3 = RemainNums3[index];
RemainNums3.RemoveAt(index);
pic6.Image = Image.FromFile(path + ARandomNumber3 + ".jpg");
index = r.Next(0, RemainNums3.Count - 1);
ARandomNumber3 = RemainNums3[index];
RemainNums3.RemoveAt(index);
pic9.Image = Image.FromFile(path + ARandomNumber3 + ".jpg");
}
private void button3_Click_1(object sender, EventArgs e)
{
SLOTMECH.Stop();
SLOTMECH.Interval = 300;
button2.Enabled = true;
}
private void pictureBox12_Click(object sender, EventArgs e)
{
}
}
}
</code>