C# TextBox Nesnesi Kullanımı

Csharp TextBox Nesnesi Kullanımı

C# TextBox Nesnesi Kullanımı. C# programında kullanılan TextBox nesnesinin en çok kullanılan özelliklerini kapsayan örnek bir uygulama kodlarıyla birlikte aşağıda verilmiştir. Bu programda TextBox nesnesinin en sık kullanılan özellikleri anlatılıyor.

Program Kodları:

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

namespace textbox_özellikleri
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.HideSelection = false;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //TextBoxı Labele Yazdır
            label1.Text = textBox1.Text;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //TextBoxı Temizle
            textBox1.Text = "";
            textBox1.Clear();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            //TextBoxın arkaplan rengini değiştir
            textBox1.BackColor= Color.Yellow;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            //TextBoxın yazı rengini değiştir
            textBox1.ForeColor = Color.Red;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            //TextBoxı Aktif yap
            textBox1.Enabled = true;
        }

        private void button6_Click(object sender, EventArgs e)
        {
            //TextBoxı Pasif yap
            textBox1.Enabled = false;
        }

        private void button7_Click(object sender, EventArgs e)
        {
            //TextBoxı Görünmez yap
            textBox1.Visible = false;
        }

        private void button8_Click(object sender, EventArgs e)
        {
            //TextBoxı Görünür yap
            textBox1.Visible = true;
        }

        private void button9_Click(object sender, EventArgs e)
        {
            //TextBoxın Maksimum uzunluğunu 15 yap
            textBox1.MaxLength = 15;
        }

        private void button10_Click(object sender, EventArgs e)
        {
            //42 yıldızın ascii kodu.Farklı bir karakterde kullanabiliriniz
            textBox1.PasswordChar = (char)42; 
        }

        private void button11_Click(object sender, EventArgs e)
        {
            //TextBoxtaki yazıyı seç
            textBox1.SelectAll();
        }
    }
}

Ekran Görüntüleri


C# TextBox Nesnesi Kullanımı. C# programında kullanılan TextBox nesnesinin en çok kullanılan özelliklerini kapsayan örnek bir uygulama kodlarıyla birlikte aşağıda verilmiştir. Bu programda TextBox nesnesinin en sık kullanılan özellikleri anlatılıyor.

Program Kodları:

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

namespace textbox_özellikleri
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.HideSelection = false;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //TextBoxı Labele Yazdır
            label1.Text = textBox1.Text;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //TextBoxı Temizle
            textBox1.Text = "";
            textBox1.Clear();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            //TextBoxın arkaplan rengini değiştir
            textBox1.BackColor= Color.Yellow;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            //TextBoxın yazı rengini değiştir
            textBox1.ForeColor = Color.Red;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            //TextBoxı Aktif yap
            textBox1.Enabled = true;
        }

        private void button6_Click(object sender, EventArgs e)
        {
            //TextBoxı Pasif yap
            textBox1.Enabled = false;
        }

        private void button7_Click(object sender, EventArgs e)
        {
            //TextBoxı Görünmez yap
            textBox1.Visible = false;
        }

        private void button8_Click(object sender, EventArgs e)
        {
            //TextBoxı Görünür yap
            textBox1.Visible = true;
        }

        private void button9_Click(object sender, EventArgs e)
        {
            //TextBoxın Maksimum uzunluğunu 15 yap
            textBox1.MaxLength = 15;
        }

        private void button10_Click(object sender, EventArgs e)
        {
            //42 yıldızın ascii kodu.Farklı bir karakterde kullanabiliriniz
            textBox1.PasswordChar = (char)42; 
        }

        private void button11_Click(object sender, EventArgs e)
        {
            //TextBoxtaki yazıyı seç
            textBox1.SelectAll();
        }
    }
}

Ekran Görüntüleri


Bu Yazıya Tepkin Nedir?
+1
0
+1
0
+1
0
+1
1
+1
0
+1
0
+1
0

Yorum Yap