ASDV-C-Sharp/lab7_1/lab7_1_CalebFontenot/Form1.cs
2022-11-17 14:45:04 -06:00

39 lines
1.2 KiB
C#
Executable File

namespace lab7_1_CalebFontenot
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void generateButton_Click(object sender, EventArgs e)
{
// Create an array to hold the numbers.
const int SIZE = 5;
int[] lotteryNumbers = new int[SIZE];
// Create a random object.
Random rand = new Random();
// Fill the array with random numbers, in the range of 0 through 99.
for (int index = 0; index < lotteryNumbers.Length; index++)
{
lotteryNumbers[index] = rand.Next(100);
}
// Display the array elements in the Label controls.
firstLabel.Text = lotteryNumbers[0].ToString();
secondLabel.Text = lotteryNumbers[1].ToString();
thirdLabel.Text = lotteryNumbers[2].ToString();
fourthLabel.Text = lotteryNumbers[3].ToString();
fithLabel.Text = lotteryNumbers[4].ToString();
}
private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}
}
}