19 Mayıs 2013 Pazar

Checkbox Kullanımı - Csharp

Csharp'ta Checkbox kullanacağız. Çalışmamıza 3 tane checkbox ekleyeceğiz. Bunların seçilip seçilmediğini kontrol edeceğiz.
/****************************************************--------------------------------------------**********************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace checkBox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        double toplam;
        private void button1_Click(object sender, EventArgs e)
        {
//textbox'a girilen değeri bir double değişkenine atıyoruz. Sebebi girilen değer ondalık bir sayı olabilir
            toplam = Convert.ToDouble(textBox1.Text);
//sonra checkbox'ları kontrol ediyoruz. Onlar seçilimi değilmi diye
            if (checkBox2.Checked)
                toplam = toplam + 22;
            if (checkBox1.Checked)
                toplam = toplam * 1.18;
            if (checkBox3.Checked)
                toplam = toplam * 1.25;
//en sonunda toplam tutarı başka bir textbox'a atıyoruz.
            textBox2.Text = Convert.ToString(toplam);


        }

        }
    }
Çalışmayı buradan indirebiliriz: https://hotfile.com/dl/223543339/8479b53/checkBox.rar.html

Hiç yorum yok :

Yorum Gönder

Google PageRank Checker Powered by  MyPagerank.Net