Akis Forum

Welcome to AkisForum.com! Register your free account today and become a member! Once signed in, you'll be able to dive into learning to code, discovering new tools, and keeping up with the latest trends. AkisForum is where benefit, knowledge, and sharing come together. Join us to add your own topics and posts, and connect with other members through your private inbox!

[C#] Basit Yapılacaklar Listesi (To-Do App) – Windows Forms

sefack

Member
Akisor
Açıklama:
Windows Forms kullanılarak hazırlanmış basit bir yapılacaklar listesi uygulaması. Görev ekleme ve silme işlemleri yapılabilir. Başlangıç seviyesindekiler için uygundur.

Kodlar:

Program.cs
C#:
using System;
using System.Windows.Forms;

namespace TodoApp
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}

MainForm.cs
C#:
using System;
using System.Windows.Forms;

namespace TodoApp
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void btnEkle_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtGorev.Text))
            {
                lstGorevler.Items.Add(txtGorev.Text);
                txtGorev.Clear();
            }
        }

        private void btnSil_Click(object sender, EventArgs e)
        {
            if (lstGorevler.SelectedIndex != -1)
            {
                lstGorevler.Items.RemoveAt(lstGorevler.SelectedIndex);
            }
        }
    }
}

MainForm.Designer.cs
C#:
namespace TodoApp
{
    partial class MainForm
    {
        private System.ComponentModel.IContainer components = null;
        private System.Windows.Forms.TextBox txtGorev;
        private System.Windows.Forms.Button btnEkle;
        private System.Windows.Forms.Button btnSil;
        private System.Windows.Forms.ListBox lstGorevler;

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.txtGorev = new System.Windows.Forms.TextBox();
            this.btnEkle = new System.Windows.Forms.Button();
            this.btnSil = new System.Windows.Forms.Button();
            this.lstGorevler = new System.Windows.Forms.ListBox();
            this.SuspendLayout();
            // 
            // txtGorev
            // 
            this.txtGorev.Location = new System.Drawing.Point(12, 12);
            this.txtGorev.Size = new System.Drawing.Size(200, 20);
            // 
            // btnEkle
            // 
            this.btnEkle.Location = new System.Drawing.Point(220, 10);
            this.btnEkle.Size = new System.Drawing.Size(75, 23);
            this.btnEkle.Text = "Ekle";
            this.btnEkle.Click += new System.EventHandler(this.btnEkle_Click);
            // 
            // btnSil
            // 
            this.btnSil.Location = new System.Drawing.Point(220, 40);
            this.btnSil.Size = new System.Drawing.Size(75, 23);
            this.btnSil.Text = "Sil";
            this.btnSil.Click += new System.EventHandler(this.btnSil_Click);
            // 
            // lstGorevler
            // 
            this.lstGorevler.Location = new System.Drawing.Point(12, 40);
            this.lstGorevler.Size = new System.Drawing.Size(200, 150);
            // 
            // MainForm
            // 
            this.ClientSize = new System.Drawing.Size(310, 200);
            this.Controls.Add(this.txtGorev);
            this.Controls.Add(this.btnEkle);
            this.Controls.Add(this.btnSil);
            this.Controls.Add(this.lstGorevler);
            this.Text = 
"Yapılacaklar Listesi";
            this.ResumeLayout(false);
            this.PerformLayout();
        }
    }
}
 
Geri
Üst