String Example

Description :
In this example, User can insert data on TextBox and when it will click on button 1, it will display on Labelbox. We introduce text formating on Labelbox  such as color change and font weight.

Ingredients :
1) One Textbox
2) One LabelBox
3) One Button

Programming :

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            String A;
            A = textBox1.Text;
            label1.ForeColor = System.Drawing.Color.Chocolate;
          label1.Font = new Font(label1.Font, FontStyle.Bold);
          label1.Text = A;
        }
    }
}


( Before )


( After )


No comments:

Post a Comment