I trying to get the data from my listbox and store it in a database. This program is supposed to roll 2 sets of dice 100 times. I want to store the rolls in a table so that I can sort the data using LINQ.
Please Help,
using System;
using System.Collections;
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;
namespace DiceApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
listBoxRolls0.Items.Clear();
listBoxRolls1.Items.Clear();
Random rdom0 = new Random();
int dice0;
int dice1;
for (int i=1;i<=100;i++)
{
dice0 = rdom0.Next(6)+1;
dice1 = rdom0.Next(6)+1;
listBoxRolls0.Items.Add(" Dice One - " + dice0 + " Dice Two - " + dice1);
}
Random rdom1 = new Random();
for (int i = 1; i < 100; i++)
{
dice0 = rdom1.Next(6) + 1;
dice1 = rdom1.Next(6) + 1;
listBoxRolls1.Items.Add(" Dice One - " + dice0 + " Dice Two - " + dice1);
}
int[,] DiceRolls = new int[2,100];
}
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire