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ü:
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
+1
+1
+1
+1
+1
+1
<< Önceki Yazı
Sonraki Yazı >>
c#, c# birden fazla checkbox kontrolü, c# checkbox çoklu seçim, c# checkbox ile hesaplama örneği, c# checkbox kullanımı örnekleri, c# checkbox örneği, c# checkbox örnekleri, c# checkbox seçili ise, c# checkbox tek seçim, c# checkbox temizleme, c# checkbox vergi hesaplama, c# checkbox veritabanına kaydetme, c# kodları, c# örnekleri, c# uygulamaları