using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
using System.Text;
namespace NumeriRandomPerEstrazioni
{
/// <summary>
/// Descrizione di riepilogo per Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Necessario per il supporto di Progettazione Windows Form
//
InitializeComponent();
//
// TODO: aggiungere il codice del costruttore dopo la chiamata a InitializeComponent
//
}
/// <summary>
/// Pulire le risorse in uso.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
public void Genera()
{
string chars = "123456789";
int i2;
string r = "";
Random rnd
= new Random
(DateTime.
Now.
Millisecond);
for (int j = 1; j<3; j++)
{
i2 = Convert.ToInt32( rnd.Next(0,9) );
r += chars.Substring(i2,1);
}
MessageBox.Show("Numero Estratto: " + r);
}
#region Codice generato da Progettazione Windows Form
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.
button1 = new System.
Windows.
Forms.
Button();
this.SuspendLayout();
//
// button1
//
this.
button1.
Location = new System.Drawing.
Point(112, 56
);
this.button1.Name = "button1";
this.
button1.
Size = new System.Drawing.
Size(80, 24
);
this.button1.TabIndex = 7;
this.button1.Text = "GeNeRa";
this.
button1.
Click += new System.
EventHandler(this.
button1_Click_1);
//
// Form1
//
this.
AutoScaleBaseSize = new System.Drawing.
Size(5, 13
);
this.
ClientSize = new System.Drawing.
Size(336, 144
);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "GeNeRa NuMeRi RaNDoM By SaTaNa";
this.
Load += new System.
EventHandler(this.
Form1_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Il punto di ingresso principale dell'applicazione.
/// </summary>
[STAThread]
static void Main()
{
Application.
Run(new Form1
());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
}
private void button1_Click_1(object sender, System.EventArgs e)
{
Thread t
= new Thread
(new ThreadStart
(Genera
));
t.Start();
}
}
}