• Giriş

Gorsel Programlama

  • AnaSayfa
  • Hakkımızda
  • TOP-10 Proje
  • Download
  • Özel Ders
  • Reklam Verin
  • Destek
  • İletişim
RSS feed
  • Youdao
  • Xian Guo
  • Zhua Xia
  • Google
  • My Yahoo!
  • newsgator
  • Bloglines
  • iNezha
© 2009-2020 Gorsel Programlama

C# WindowsForm Çekiliş Uygulaması

C# WindowsForm Çekiliş Uygulaması

Daha fazlası için: gorselprogramlama.com

Merhaba ben Abdurrahman ÖNDER. Bu uygulamamızın amacı, dışarıdan girilen hediye ve katılımcıya göre rastgele çekiliş gerçekleştirmektir.

Tasarımımızı aşağıdaki gibi yapalım.

IMG_20201203_020434

Katılımcı Ekleme Butonu Click_Event yazalım.

private void btnKEkle_Click(object sender, EventArgs e)
 {
 if (txtAd.Text.Trim() != "" && txtSoyad.Text.Trim() != "" && txtTel.Text.Trim() != "")
 {
 bool add_state = true;
 foreach (string s in lstKatilim.Items)
 {
 string tel = s.Split(' ')[2].ToString();
 if (tel == txtTel.Text.Trim())
 {
 add_state = false;
 break;
 }
 }
 if (add_state)
 {
 string ad = txtAd.Text.Trim();
 string soyad = txtSoyad.Text.Trim();
 string no = txtTel.Text.Trim();
 lstKatilim.Items.Add(ad + " " + soyad + " " + no);
 }
 else
 {
 MessageBox.Show("Numara tekrarı algılandı! Tekrar deneyiniz!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
 txtAd.ResetText();
 txtSoyad.ResetText();
 txtTel.ResetText();
 txtAd.Focus();
 }
 }

Hediye Ekleme Butonu Click_Event yazalım.

 

private void btnHEKle_Click(object sender, EventArgs e)
 {
 if (txtHediyeAd.Text.Trim() != "" && txtHediyeTur.Text.Trim() != "" && txtHediyeMarka.Text.Trim() != "" && txtHediyeAdet.Text.Trim() != "")
 {
 bool add_state = true;
 string ad = txtHediyeAd.Text.Trim();
 string tur = txtHediyeTur.Text.Trim();
 string marka = txtHediyeMarka.Text.Trim();
 int adet = Convert.ToInt32(txtHediyeAdet.Text.Trim());
 foreach (string s in lstHediye.Items)
 {
 if (s == ad + " " + tur + " " + marka + " " + adet.ToString())
 {
 add_state = false;
 break;
 }
 }
 if (add_state)
 {
 for (int i = 0; i < adet; i++)
 lstHediye.Items.Add(ad + " " + tur + " " + marka + " ");
 }
 else
 {
 MessageBox.Show("Aynı Hediye Sistemde Mevcut! Tekrar Deneyiniz!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
 txtHediyeAd.ResetText();
 txtHediyeMarka.ResetText();
 txtHediyeTur.ResetText();
 txtHediyeAdet.ResetText();
 txtHediyeAd.Focus();
 }
 }

Çekiliş Başlatma Butonu Click_Event yazalım.

 

private void btnBaslat_Click(object sender, EventArgs e)
 {
 int hediyeSayisi = lstHediye.Items.Count;
 if (lstKatilim.Items.Count != 0 && lstHediye.Items.Count != 0)
 {
 lstSonuc.Items.Clear();
 Random rnd = new Random();
 Random rnd2 = new Random();
 for (int i = 0; i < hediyeSayisi; i++)
 {
 if (lstKatilim.Items.Count != 0)
 {
 int hediyeIndex = rnd.Next(0, lstHediye.Items.Count - 1);
 int katilimIndex = rnd.Next(0, lstKatilim.Items.Count - 1);
 lstSonuc.Items.Add(lstHediye.Items[hediyeIndex] + " --> " + lstKatilim.Items[katilimIndex]);
 lstHediye.Items.RemoveAt(hediyeIndex);
 lstKatilim.Items.RemoveAt(katilimIndex);
 }
 }
 }
 }

Telefon ve Adet textboxlarının sadece rakam alması için

 

 private void txtTel_KeyPress(object sender, KeyPressEventArgs e)
 {
   e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
 }

 

Resetleme Butonu Click_Event yazalım.

 private void btnReset_Click(object sender, EventArgs e)
 {
 lstKatilim.Items.Clear();
 lstSonuc.Items.Clear();
 lstHediye.Items.Clear();
 }

Projeyi indirmek için buraya tıklayınız. Ödev ve Fikir konularında mail atabilirsiniz.

Mail Adresim abdurrahman.onder@ogr.sakarya.edu.tr

Sağlıkla, mutlulukla…

Paylaş :
Tweet
Yorum Yazın | Geri
3 Aralık Perşembe,2020 Tarihinde Yayınlanmıştır. Bulunduğu Kategori : C#, Görsel Programlama, GorselProgramlama.Com
Etiket:
« C# WindowsForm Login Remember Me (Remember me Checkbox) C# Console Application İçi Boş Üçgen »
Henüz Yorum Yok.

Yorum Yazın ...

Cevabı İptal
XHTML: Bu Etiketleri Kullanabilirsiniz : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
RSS Bu Yazıya Yapılan Yorumlar


Site içi Arama

Takip et: @GorselProgram







Böyle bir web sayfam olsun diyorsanız iletişim bölümünden veya gorselprogram@gmail.com mail adresinden bize ulaşabilirsiniz.

Son Yazılar

  • C# Console Application İçi Boş Üçgen
  • C# WindowsForm Çekiliş Uygulaması
  • C# WindowsForm Login Remember Me (Remember me Checkbox)
  • Migros market 2 Reklam Banner Örneği — Flash
  • C# WindowsForm ile TC Kimlik Numarası, İsim, Soyisim, E-Mail Kontrol Yapıları

Etiket Bulutu

.NET Application basit C# C#.NET application C#.NET codes C#.NET examples C#.NET lessons C#.NET practice C#.net örnekleri c# console dersleri c# console örnekleri C# ders c# dersleri c# örnek c# örnekleri C.net dersleri c dersleri code console console örnekleri Csharp csharp dersleri csharp net csharp örnekleri c örnekleri download Flash örnekleri forms Forms örnekleri full indir kod kodlar nesne tabanlı programlama OleDbConnection OleDbDataAdapter tam sürüm uygulama vb net win windows windows forms application örnek ücretsiz

Kategoriler

  • Access (59)
  • Akış Diyagramı Flowchart (69)
  • Android Eğitimleri (2)
  • Asp Net (47)
  • C# (830)
  • C# Console (222)
  • Css (19)
  • Dersler (191)
  • Dökümanlar (21)
  • Dreamweaver (12)
  • Excel (8)
  • Fireworks (27)
  • Flash (76)
  • Görsel Programlama (419)
  • GorselProgramlama.Com (8)
  • Html (34)
  • Pascal (2)
  • Photoshop (5)
  • PHP (2)
  • Planlar (114)
  • Programlama Tanım (4)
  • Sınavlar (128)
  • Sql (10)
  • VB 6.0 (45)
  • VB.NET (219)
  • Videolar (65)
  • Word (7)

Arşiv

Bağlantılar

  • Html Dersleri
  • Muslu.NET
  • Programlama Dersleri

Kimler Sitede ?


    Computers Blogs Top programming blogs

   sayaç Powered by WordPress | Theme by NeoEase | Valid XHTML 1.1 and CSS 3 Yukarı