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 Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Display()
{
int t = 0;
if (Chk500.Checked)
t += 500;
if (Chk1000.Checked)
t += 1000;
if (Chk1500.Checked)
t += 1500;
TxtTotal.Text = t.ToString();
}
private void Chk500_CheckedChanged(object sender, EventArgs e)
{
Display();
}
private void Chk1000_CheckedChanged(object sender, EventArgs e)
{
Display();
}
private void Chk1500_CheckedChanged(object sender, EventArgs e)
{
Display();
}
}
}
Note :(+= )means It will add Previous Value and Current Value.
No comments:
Post a Comment