Skip to content

Instantly share code, notes, and snippets.

@ouzdev
Last active December 16, 2019 13:46
Show Gist options
  • Save ouzdev/e79af447970afce152f1c0d5295a1063 to your computer and use it in GitHub Desktop.
Save ouzdev/e79af447970afce152f1c0d5295a1063 to your computer and use it in GitHub Desktop.
Dolar Euro TL Çevirici
using System;
using System.Collections;
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 Method3
{
public partial class Form1 : Form
{
int dolar_global;
int euro_global;
public Form1()
{
InitializeComponent();
dolar_global = Convert.ToInt32(lbl_dolar.Text);
euro_global = Convert.ToInt32(lbl_euro.Text);
btn_hesapla.Enabled = false;
}
ArrayList dolar_listesi = new ArrayList();
//object referrer nesne atıfının adı dolar_listesi
ArrayList euro_listesi = new ArrayList();
private void button1_Click(object sender, EventArgs e)
{
int tl = Convert.ToInt32(textBox1.Text);
if (radioButton1.Checked)
{
int sonuc = tl * dolar_global;
string dolar_metni = sonuc.ToString() + "/Dolar";
dolar_listesi.Add(dolar_metni);
listBox1.Items.Add(dolar_metni);
}
else if (radioButton2.Checked)
{
int sonuc = tl * euro_global;
string euro_metni = sonuc.ToString() + "/Euro";
euro_listesi.Add(euro_metni);
listBox1.Items.Add(euro_metni);
}
textBox1.Clear();
}
private void btn_degistir_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
dolar_global = Convert.ToInt32(textBox3.Text);
for (int i = 0; i < dolar_listesi.Count; i++)
{
string[] degisecek_item = dolar_listesi[0].ToString().Split('/');
string ss = degisecek_item[0];
int asil_sayi = Convert.ToInt32(ss) / Convert.ToInt32(lbl_dolar.Text);
int yeni_sonuc = asil_sayi * dolar_global;
string cok_yeni_sonuc = yeni_sonuc.ToString() + "/Dolar";
dolar_listesi.RemoveAt(0);
dolar_listesi.Add(cok_yeni_sonuc);
}
lbl_dolar.Text = textBox3.Text;
}
else if (radioButton2.Checked)
{
euro_global = Convert.ToInt32(textBox3.Text);
for (int i = 0; i < euro_listesi.Count; i++)
{
string[] degisecek_item = euro_listesi[0].ToString().Split('/');
string ss = degisecek_item[0];
int asil_sayi = Convert.ToInt32(ss) / Convert.ToInt32(lbl_euro.Text);
int yeni_sonuc = asil_sayi * euro_global;
string cok_yeni_sonuc = yeni_sonuc.ToString() + "/Euro";
euro_listesi.RemoveAt(0);
euro_listesi.Add(cok_yeni_sonuc);
}
lbl_euro.Text = textBox3.Text;
}
listBox1.Items.Clear();
foreach (var item in dolar_listesi)
{
listBox1.Items.Add(item);
}
foreach (var item in euro_listesi)
{
listBox1.Items.Add(item);
}
textBox3.Clear();
}
public void Dolar(int dolar)
{
lbl_dolar.Text = "Dolar(" + dolar + ")";
}
public void Euro(int euro)
{
lbl_dolar.Text = "Euro(" + euro + ")";
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
btn_hesapla.Enabled = true;
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
btn_hesapla.Enabled = true;
}
}
}
namespace Method3
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.btn_hesapla = new System.Windows.Forms.Button();
this.btn_degistir = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.lbl_dolar = new System.Windows.Forms.Label();
this.lbl_euro = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(9, 36);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 22);
this.textBox1.TabIndex = 0;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(9, 190);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(100, 22);
this.textBox3.TabIndex = 2;
//
// btn_hesapla
//
this.btn_hesapla.Location = new System.Drawing.Point(9, 73);
this.btn_hesapla.Name = "btn_hesapla";
this.btn_hesapla.Size = new System.Drawing.Size(100, 31);
this.btn_hesapla.TabIndex = 3;
this.btn_hesapla.Text = "Hesapla";
this.btn_hesapla.UseVisualStyleBackColor = true;
this.btn_hesapla.Click += new System.EventHandler(this.button1_Click);
//
// btn_degistir
//
this.btn_degistir.Location = new System.Drawing.Point(9, 218);
this.btn_degistir.Name = "btn_degistir";
this.btn_degistir.Size = new System.Drawing.Size(100, 42);
this.btn_degistir.TabIndex = 4;
this.btn_degistir.Text = "Kuru Güncelle";
this.btn_degistir.UseVisualStyleBackColor = true;
this.btn_degistir.Click += new System.EventHandler(this.btn_degistir_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(281, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 17);
this.label1.TabIndex = 5;
this.label1.Text = "TL ";
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 16;
this.listBox1.Location = new System.Drawing.Point(127, 9);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(309, 372);
this.listBox1.TabIndex = 8;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(9, 133);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(17, 16);
this.radioButton1.TabIndex = 9;
this.radioButton1.TabStop = true;
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(9, 160);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(63, 21);
this.radioButton2.TabIndex = 10;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Euro ";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// lbl_dolar
//
this.lbl_dolar.AutoSize = true;
this.lbl_dolar.Location = new System.Drawing.Point(74, 133);
this.lbl_dolar.Name = "lbl_dolar";
this.lbl_dolar.Size = new System.Drawing.Size(16, 17);
this.lbl_dolar.TabIndex = 11;
this.lbl_dolar.Text = "6";
//
// lbl_euro
//
this.lbl_euro.AutoSize = true;
this.lbl_euro.Location = new System.Drawing.Point(74, 162);
this.lbl_euro.Name = "lbl_euro";
this.lbl_euro.Size = new System.Drawing.Size(16, 17);
this.lbl_euro.TabIndex = 12;
this.lbl_euro.Text = "6";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(27, 132);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(42, 17);
this.label2.TabIndex = 13;
this.label2.Text = "Dolar";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(64, 132);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(13, 17);
this.label3.TabIndex = 14;
this.label3.Text = "(";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(92, 161);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(13, 17);
this.label5.TabIndex = 17;
this.label5.Text = ")";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(64, 161);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(13, 17);
this.label6.TabIndex = 16;
this.label6.Text = "(";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(92, 132);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(13, 17);
this.label4.TabIndex = 15;
this.label4.Text = ")";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(21, 109);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(75, 17);
this.label7.TabIndex = 18;
this.label7.Text = "Seçim Yap";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(447, 400);
this.Controls.Add(this.label7);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.lbl_euro);
this.Controls.Add(this.lbl_dolar);
this.Controls.Add(this.radioButton2);
this.Controls.Add(this.radioButton1);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btn_degistir);
this.Controls.Add(this.btn_hesapla);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Dolar Euro TL Çevirici v.1.0";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button btn_hesapla;
private System.Windows.Forms.Button btn_degistir;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.Label lbl_dolar;
private System.Windows.Forms.Label lbl_euro;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label7;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment