folder Tahribat.com Forumları
linefolder C#, Asp.Net, .Net Core
linefolder C# Örnekleri - Sayıyı Yazıya Çevirme



C# Örnekleri - Sayıyı Yazıya Çevirme

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    saybirs
    saybirs's avatar
    Kayıt Tarihi: 24/Temmuz/2009
    Erkek

    Rene : Yararlı kod, silmeyin...

               

    // Textbox1'den girilen rakamı textbox2'de yazı ile gösteriyo 

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace sayı_okuma
    {
    public partial class Form1 : Form
    {
    int i,yer;
    string [] birler=new string[10]{"","BİR","İKİ","ÜÇ","DÖRT","BEŞ","ALTI","YEDİ","SEKİZ","DOKUZ"};
    string[] onlar = new string[10] { "", "ON", "YİRMİ", "OTUZ", "KIRK", "ELLİ", "ALTMIŞ", "YETMİŞ", "SEKSEN", "DOKSAN" };
    public Form1()
    {
    InitializeComponent();
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
    yer=comboBox1.SelectedIndex;
    if (comboBox1.Text.Length == 1)
    {
    if (comboBox1.SelectedIndex == 0)
    label2.Text = "SIFIR";
    else
    {

    label2.Text = birler[yer];
    }
    }
    else if (comboBox1.Text.Length == 2)
    {
    label2.Text = onlar[Convert.ToInt32(comboBox1.Text.Substring(0, 1))] + " " + birler[Convert.ToInt32(comboBox1.Text.Substring(1, 1))];
    }
    else
    {
    if (comboBox1.Text.Substring(0, 1) == "1")
    label2.Text = "YÜZ" + " " + onlar[Convert.ToInt32(comboBox1.Text.Substring(1, 1))] +" "+ birler[Convert.ToInt32(comboBox1.Text.Substring(2, 1))];
    else
    {
    label2.Text = birler[Convert.ToInt32(comboBox1.Text.Substring(0, 1))] + "YÜZ" + " " + onlar[Convert.ToInt32(comboBox1.Text.Substring(1, 1))] +" "+ birler[Convert.ToInt32(comboBox1.Text.Substring(2, 1))];
    }
    }
    }

    private void Form1_Load(object sender, EventArgs e)
    {
    for (i = 0; i < 1000; i++)
    {
    comboBox1.Items.Add(i);
    }
    }
    }
    }

    // Kronometre Yapımı

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace kronometre
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    int a1, b1, c1;
    string a2, b2, c2;

    private void c_play_CheckedChanged(object sender, EventArgs e)
    {

    if (c_play.Checked == true)
    {
    c_play.Text = "Pause";
    timer1.Start();
    btn_stop.Enabled = true;
    btn_time.Enabled = true;
    btn_clear.Enabled = true;
    }
    else
    {
    c_play.Text = "Play";
    timer1.Stop();
    btn_stop.Enabled = false;
    btn_time.Enabled = false;
    btn_clear.Enabled = false;
    }
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
    lbl.Text=a2+":"+b2+":"+c2;
    c1 = c1 + 1;
    if (c1 >= 99)
    {
    c1 = 0;
    b1 = b1 + 1;
    }
    if (b1 >= 60)
    {
    b1 = 0;
    a1 = a1 + 1;
    }
    if (c1 < 10)
    c2 = "0" + c1.ToString();
    else
    c2 = c1.ToString();
    if (b1 < 10)
    b2 = "0" + b1.ToString();
    else
    b2 = b1.ToString();
    if (a1 < 10)
    a2 = "0" + a1.ToString();
    else
    a2 =a1.ToString();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
    a1 = 0;
    b1 = 0;
    c1 = 0;
    }

    private void btn_stop_Click(object sender, EventArgs e)
    {
    timer1.Stop();
    lbl.Text = "00:00:00";
    a1 = 0;
    b1 = 0;
    c1 = 0;
    c_play.Text = "Play";
    c_play.Checked = false;
    }

    private void btn_time_Click(object sender, EventArgs e)
    {
    liste.Items.Add(lbl.Text);
    }

    private void btn_clear_Click(object sender, EventArgs e)
    {
    timer1.Stop();
    a1 = 0;
    b1 = 0;
    c1 = 0;
    lbl.Text = "00:00:00";
    liste.Items.Clear();
    btn_stop.Enabled = false;
    btn_time.Enabled = false;
    btn_clear.Enabled = false;
    c_play.Text = "Play";
    c_play.Checked = false;
    }


    }
    }
     

    //Mausun sol tıkıyla tıklanan yere gelen label yapma

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace mouse_2
    {
    public partial class Form1 : Form
    {
    int x, y;
    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
    x = e.X;
    y = e.Y;
    if (e.Button == MouseButtons.Left)
    {
    timer1.Start();
    timer2.Stop();
    }
    if (e.Button == MouseButtons.Right)
    {
    timer2.Start();
    timer1.Stop();
    }
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
    timer2.Stop();
    this.Text = label1.Left + " / " + label1.Top;
    if (label1.Left + (label1.Width / 2) < x)
    {
    label1.Left = label1.Left + 1;
    }
    else if (label1.Left + (label1.Width / 2) >x)
    {
    label1.Left = label1.Left - 1;
    }
    else
    {
    if (label1.Top + (label1.Height / 2) < y)
    {
    label1.Top = label1.Top + 1;
    }
    else if (label1.Top + (label1.Height) / 2 > y)
    {
    label1.Top = label1.Top - 1;
    }
    else
    timer1.Stop();

    }

    }

    private void timer2_Tick(object sender, EventArgs e)
    {
    timer1.Stop();
    this.Text = label1.Left + " / " + label1.Top;
    if (label1.Top + (label1.Height / 2) < y)
    {
    label1.Top = label1.Top + 1;

    }
    else if (label1.Top + (label1.Height) / 2 > y)
    {
    label1.Top = label1.Top - 1;

    }
    else
    {
    if (label1.Left + (label1.Width / 2) < x)
    {
    label1.Left = label1.Left + 1;

    }
    else if (label1.Left + (label1.Width / 2) > x)
    {
    label1.Left = label1.Left - 1;
    }
    else
    timer1.Stop();

    }
    }
    }
    }
     

    // Textbox'a girilen yazının label'de ters bir şekilde timer yardımıyla yazılması.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace timer_3
    {
    public partial class Form1 : Form
    {
    int say;
    string ifade1;
    public Form1()
    {
    InitializeComponent();
    }

    private void txt_ifade_TextChanged(object sender, EventArgs e)
    {
    btn_tersle.Enabled = true;
    timer1.Stop();
    timer2.Stop();
    lbl_ters.Text = "";
    if (txt_ifade.Text == "")
    btn_tersle.Enabled = false;
    }

    private void btn_tersle_Click(object sender, EventArgs e)
    {
    say = Convert.ToInt32(txt_ifade.TextLength-1);
    timer1.Start();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
    ifade1 = Convert.ToString(txt_ifade.Text.Substring(say, 1));
    lbl_ters.Text = Convert.ToString(lbl_ters.Text + ifade1);
    say = say - 1;
    if (say < 0)
    {
    timer1.Stop();
    timer2.Start();
    }
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
    say = Convert.ToInt32(txt_ifade.TextLength - 1);
    lbl_ters.Text = "";
    timer2.Stop();
    timer1.Start();
    }


    }
    }
       Programların tasarım ve kodları sadece bana aittir.Hiçbir şekilde alıntı yapılmamıştır. 

  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    saybirs
    saybirs's avatar
    Kayıt Tarihi: 24/Temmuz/2009
    Erkek

    devamı gelecek.

  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    SARI
    SARI's avatar
    Banlanmış Üye
    Kayıt Tarihi: 29/Eylül/2009
    Erkek

    harbi güzel paylaşım inşallah devamı gelir.. eline koluna sağlık..


    Ban Sebebi : Molrada Haarket Eiğtti için Bdnlaanı... Türkçe öğretmenliği okuyan arkadaşım sana ders verebilir admin arkadaş :)
  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    solstice
    solstice's avatar
    Kayıt Tarihi: 04/Nisan/2008
    Erkek

    teşekkürler hocam güzel paylaşım ..


    https://www.youtube.com/watch?v=k6LrGZGqYn8
Toplam Hit: 3312 Toplam Mesaj: 4