C# CheckBox ile KDV Hesaplama - Bilişim Konuları

C# CheckBox ile KDV Hesaplama

Bu örnek programımızda klavyeden girilen herhangi bir tutarın vergi tutarlarının hesaplanması ve toplam tutarın bulunması işlemini yapacağız. Öncelikle hangi vergi oranlarının hesaplanmasını istiyorsak ilgili vergi oranları için checkBox nesnesinden faydalanacağız. Forma 3 tane checkBox nesnesi 5 tane textBox nesnesi 1 tanede button nesnesi ekliyoruz. Buton nesnesinin Click özelliğine aşağıdaki kodu yazarak seçilen vergi oranına göre gerekli hesaplamaları yaparak sonuçları textBox nesnesi içerisinde ekranda gösteriyoruz.

Programın ekran görüntüsü:

csharpvergihesaplama

Programın Visual C# kodları:

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 heckbox_kullanımı_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double otv=0, kdv=0, dm=0, gelfiy=0, satfiy=0;
            gelfiy = Convert.ToDouble(textBox1.Text);
            if (checkBox1.Checked)
            {
                otv = gelfiy * 0.45;
            }
            if (checkBox2.Checked)
            {
                kdv = gelfiy * 0.18;
            }
            if (checkBox3.Checked)
            {
                dm = gelfiy * 0.001;
            }
            textBox2.Text = otv.ToString();
            textBox3.Text = kdv.ToString();
            textBox4.Text = dm.ToString();
            textBox5.Text = (gelfiy + otv + kdv + dm).ToString();
        }
    }
}

Bu Yazıya Tepkin Nedir?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Yorum Yap