C# Form Uygulamaları-İl İlçe Sıralama Uygulaması
C#’ta bir kaç işlemle il ilçe ve mahallelerini sıralayan bir uygulama ile karşınızdayız! Nasıl yapıldığını, uygulamayı yaparken neler kullandığımızı ve niçin kullandığımızı yazımızın içeriğinde bulabilirsiniz. Keyifli uygulamalar.
İÇİNDEKİLER
C# Form Uygulamasının Detayları:
Arayüz:
Üç tane ComboBox: Üç tane ComboBox sırasıyla il, ilçe ve mahalleleri listelemek için kullanılmıştır.
Üç tane Label: Üç adet Label ise comboboxları açıklamak amaçlı kullanılmıştır.
Bir tane Button: Bilgileri kaydetmek ve listelemek için button kullanılmıştır.
Bir tane ListBox: Kayıt edilen bilgileri listelemek için bir adet listbox kullanılmıştır.
İşleyiş:
- Kullanıcı öncelikle ili seçer.
- Sonra ilçeyi seçer.
- Daha sonrada mahalleyi seçer ve kaydet butonuna basar.
- Böylelikle kayıt edilen bilgiler formun ekranındaki listboxta görüntülenecek.
Şimdi gelin hep birlikte bu konuyu pekiştirelim. Ne demişler en iyi öğrenme yöntemi, uygulayarak öğrenmedir : )
Kod Blogu
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
//KAYDET BUTONU private void button1_Click(object sender, EventArgs e) { listBox1.Items.Add("İL : " + comboBox1.Text + "\t\t İLÇE : " + comboBox2.Text + "\t\t MAHALLE : " + comboBox3.Text); MessageBox.Show("Başarılı bir şekilde eklendi", "İşlem Tamam", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); } //İL SEÇİMİ private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.Text == "İZMİR") { comboBox2.Items.Clear(); comboBox3.Items.Clear(); string[] ilce = { "KARŞIYAKA", "BORNOVA", "ÇİĞLİ" }; comboBox2.Items.AddRange(ilce); } else if (comboBox1.Text == "İSTANBUL") { comboBox2.Items.Clear(); comboBox3.Items.Clear(); string[] ilce = { "BEŞİKTAŞ", "KADIKÖY", "TUZLA" }; comboBox2.Items.AddRange(ilce); } else if (comboBox1.Text == "KOCAELİ") { comboBox2.Items.Clear(); comboBox3.Items.Clear(); string[] ilce = { "GEBZE", "DARICA", "ÇAYIROVA" }; comboBox2.Items.AddRange(ilce); } } //İLÇE ŞEÇİMİ private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox2.Text == "KARŞIYAKA") { comboBox3.Items.Clear(); string[] mahalle = { "İSTASYONALTI", "DEMİR" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "BORNOVA") { comboBox3.Items.Clear(); string[] mahalle = { "ULUS" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "ÇİĞLİ") { comboBox3.Items.Clear(); string[] mahalle = { "VATAN" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "BEŞİKTAŞ") { comboBox3.Items.Clear(); string[] mahalle = { "GAZİ" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "KADIKÖY") { comboBox3.Items.Clear(); string[] mahalle = { "ASMA" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "TUZLA") { comboBox3.Items.Clear(); string[] mahalle = { "ASMALI" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "GEBZE") { comboBox3.Items.Clear(); string[] mahalle = { "GÜZELTEPE" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "DARICA") { comboBox3.Items.Clear(); string[] mahalle = { "NENEHATUN" }; comboBox3.Items.AddRange(mahalle); } else if (comboBox2.Text == "ÇAYIROVA") { comboBox3.Items.Clear(); string[] mahalle = { "ZİNCİR" }; comboBox3.Items.AddRange(mahalle); } } |

“This is content excellence at its finest! The depth of research and clarity of presentation sets a new standard. Your expertise in this field is truly impressive.”
thanks