C# Mesajbox,Checkbox,Listbox,Arkaplan rengi Uygulamalar

uygulama

Komut :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BütApp
{
    public partial class Form1 : Form
    {

         int cb_sayi = 0;
         List<CheckBox> cb_liste = new List<CheckBox>();
        public Form1()
        {
            InitializeComponent();
            rdbtn_Normal.Checked = true;
        }

        private void btn_Mesaj_Click(object sender, EventArgs e)
        {
            if(rdbtn_Normal.Checked)
                 MessageBox.Show(textBox1.Text);

            else if(rdbtn_Uyarı.Checked)
                MessageBox.Show(textBox1.Text,"Uyarı",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            else if (rdbtn_Hata.Checked)
                MessageBox.Show(textBox1.Text,"Hata",MessageBoxButtons.OK,MessageBoxIcon.Error);
        }

        private void btn_Ekle_Click(object sender, EventArgs e)
        {
            listBox1.Items.Add(textBox2.Text);
            textBox2.Text = "";
        }

        private void btn_Temizle_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
                listBox1.Items.Clear();
            else if (checkBox2.Checked)
                listBox2.Items.Clear();
            else if (checkBox1.Checked && checkBox2.Checked) {
                listBox1.Items.Clear();
                listBox2.Items.Clear();
            }

            else
                MessageBox.Show("Listbox seçin..","Hata",MessageBoxButtons.OK,MessageBoxIcon.Error);

        }

        private void btn_Renk_degistir_Click(object sender, EventArgs e)
        {
            ColorDialog clr = new ColorDialog();

            if (clr.ShowDialog() == DialogResult.OK)
                this.BackColor = clr.Color;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < listBox1.Items.Count; i++)
                listBox2.Items.Add(listBox1.Items[i]);

            //listBox2.Items.Add(listBox1.SelectedItem);
        }

        private void btn_Olustur_Click(object sender, EventArgs e)
        {
            int oluşturulacak = Convert.ToInt32(nup_1.Value);

            for(int i=0;i < oluşturulacak ; i++)
            {
                CheckBox cb_dinamik = new CheckBox();
                cb_dinamik.Text = (i+1).ToString();
                cb_dinamik.Left = 250;
                cb_dinamik.Top = (i * 25) + 25;
                groupBox3.Controls.Add(cb_dinamik);

                cb_sayi++;

                cb_liste.Add(cb_dinamik);

            }
        }

        private void btn_Sil_Click(object sender, EventArgs e)
        {
            if (cb_sayi > 0)
            {
                for (int i = 0; i < cb_liste.Count; i++)
                {
                    cb_liste[i].Dispose();
                }

                cb_sayi = 0;
                cb_liste.Clear();

            }
            else
                MessageBox.Show("Silinecek checkbox yok", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        private void btn_Göster_Click(object sender, EventArgs e)
        {
            String mesaj_metni = "Secilen Checkboxlar" + Environment.NewLine;
             if (cb_sayi > 0)
            {

                 for (int i = 0; i < cb_liste.Count; i++)
                {
                   if(cb_liste[i].Checked){
                        mesaj_metni += cb_liste[i].Text + Environment.NewLine;
                   }

                }
                 MessageBox.Show(mesaj_metni, "", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
            else
                MessageBox.Show("Gösterilecek checkbox yok", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form form2 = new Form();
            form2.Show();
        }

        }

    }

C# Hesap Makinesi Uygulaması

C# Hesap Makinesi Uygulaması

calculator

Desing kısmında 

  • Sayı 1 ve Sayı 2 adında(Text’inde) Label
  • ve yanlarına iki textbox (Name) kısmı txtbxSayi1,txtbxSayi2
  • Bir dataGridView
  • dataGridView’ in içine Topla,Çıkar,Çarp,Böl tex’inde 4 Radiobutton (Name) isimleri rdbtnTopla ,rdbtnCıkar,rdbtnCarp,rdbtnBöl
  • Hesapla adında Button  (Name) btnHesapla

Komut kısmında

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HesapMakinesi
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int sonuc;
        private void rdbtnTopla_CheckedChanged(object sender, 
                                               EventArgs e)
        {
            sonuc = Convert.ToInt32(txtbxSayi1.Text) + 
                    Convert.ToInt32(txtbxSayi2.Text);
        }

        private void rdbtnÇıkar_CheckedChanged(object sender, 
                                               EventArgs e)
        {
            sonuc = Convert.ToInt32(txtbxSayi1.Text) - 
                    Convert.ToInt32(txtbxSayi2.Text);
        }

        private void rdbtnCarp_CheckedChanged(object sender,
                                              EventArgs e)
        {
            sonuc = Convert.ToInt32(txtbxSayi1.Text) *
                     Convert.ToInt32(txtbxSayi2.Text);
        }

        private void rdbtnBöl_CheckedChanged(object sender,
                                             EventArgs e)
        {
            sonuc = Convert.ToInt32(txtbxSayi1.Text) / 
                    Convert.ToInt32(txtbxSayi2.Text);
        }

        private void btnHesapla_Click(object sender, 
                                      EventArgs e)
        {
           if(txtbxSayi1.Text == "" ||
               txtbxSayi2.Text == "")
               MessageBox.Show("Boş Bırakmayınız");
            else
               MessageBox.Show(sonuc.ToString());
        }

        private void pictureBox1_Click(object sender, 
                                       EventArgs e)
        {
            System.Diagnostics.Process.Start("http://forumkod.com/",
                                          "http://ibrahimkaya.net/");
        }
    }
}

Hesap Makinesi Download