Code Snippet for random key generation in C#:
private string generateSerialNum()
{
Random r = new Random();
StringBuilder sb = new StringBuilder();
int size = 14;
string legalnums = "0123456789";
for (int i=0; i<9;i++)
{
sb.Append(legalnums.Substring(r.Next(0,legalnums.Length-1)+1,1));
} return sb.ToString();
}
private void SaleOrder_Load(object sender, EventArgs e)
{
txt_SalesID.Text = generateSerialNum();
}
Cheers,
Venkatesan Prabu .J