C# formda iki sayının toplamı
//************C# Formda iki sayının toplamı***************//
private void button1_Click(object sender, EventArgs e)
{
textBox1.Focus();
float sayi1 = Convert.ToInt32(textBox1.Text);
float sayi2 = Convert.ToInt32(textBox2.Text);
float toplam = sayi1 + sayi2;
label2.Text=Convert.ToString(toplam);
}
private void button2_Click(object sender, EventArgs e)
{
foreach (Control c in this.Controls)
{
if (c is TextBox)
{
TextBox tb = (TextBox)c;
tb.Clear();
}
}
}
Yorumlar