VasilM

rand_&_parse

Apr 5th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. namespace WindowsFormsApplication1
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.             Random rand = new Random();
  9.             textBox1.Text = rand.Next(2, 20).ToString();
  10.             textBox2.Text = rand.Next(4, 40).ToString();
  11.         }
  12.        
  13.         private void button1_Click(object sender, EventArgs e)
  14.         {
  15.             int a = Int32.Parse(textBox1.Text);
  16.             int b = Int32.Parse(textBox2.Text);
  17.             int c = a + b;
  18.             label1.Text = c.ToString();
  19.         }
  20.  
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment