Şehir Alan kodu bulan Program C#

Alan kodu bulma C# Windows Form Application

[code lang=”csharp”]
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

Hashtable liste = new Hashtable();
private void Form1_Load(object sender, EventArgs e)
{
liste.Add("Ankara", "312");
liste.Add("İstanbul", "212");
liste.Add("Kırşehir", "386");
liste.Add("Antalya", "242");
liste.Add("İzmir", "232");
liste.Add("İstanbul Anadolu", "216");
}

private void button1_Click(object sender, EventArgs e)
{
object key = textBox1.Text;
bool durum = liste.ContainsKey(key);
if (durum == true)
{
textBox2.Text = liste[key].ToString();
}
else
MessageBox.Show("Alan Kodu Bulunamadı");
}
}
}
[/code]

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir