how can i make it a random,
i mean, if a press a button
it will display 5 cards randomly...
like in the picture below
my code:
public enum m_Cards { Ten, Jack, Queen, King, Ace };
private void button1_Click(object sender, EventArgs e)
{
m_Cards[] cHand = new m_Cards[5];
Random random = new Random();
}
i tried adding for loop but says its missing a cast, so i delete it...
thank you for the help...
VulpesPosted Nov 27, 2011, 5:39 AM
Satyapriya NayakPosted Nov 27, 2011, 3:09 AM
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public enum m_Cards
{
Ten, Jack, Queen, King, Ace
}
private void button1_Click(object sender, EventArgs e)
{
Random rand = new Random();
m_Cards a= (m_Cards)(rand.Next()% 5);
textBox1.Text = a.ToString();
//MessageBox.Show(a.ToString());
}
}
}
Thanks