private void _btnSortear_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> numeros = new List <int>();

                Random R = new Random();

                for (int i = 0; i < 15; i++)
                {
                    int numero = R.Next(0, 50);

                    bool existe = false;
                    foreach (int nro in numeros)
                    {
                        if (nro == numero)
                        {
                            existe = true;
                        }
                    }

                    if (!existe)
                    {
                        numeros.Add(numero);
                    }
                    else
                    {
                        i--;
                    }
                }

                _numeros = numeros;

                string mensaje = "Los nĂºmeros sorteados son:\n | ";
                foreach (int Nro in numeros)
                {
                    mensaje += Nro.ToString() + " | ";
                }

                _lblMensaje.Text = mensaje;

                SorteoRealizado(this, new EventArgs());
            }

            catch (Exception ex)
            {
                _lblMensaje.Text = ex.Message;
            }
        }
Example #2
0
 public override string ToString()
 {
     return(Suit.ToString() + "," + Colour + "," + Nro.ToString() + "," + IsFaceDown.ToString());
 }
Example #3
0
 public override string ToString()
 {
     return(Nro.ToString());
 }