Example with Label Control:



  • Add a new Form  i.e., Form3 to the WABasics
  • Create a label on it
  • Set the Following properties to the label1

label1:-

Name          :         lblDisplay
Text            :         Sampath kumar Vaddepally

Design :-



  • Generate the Event Handler for Form Load Event i.eForm3_Load( )
  • Goto Source( Form3.cs) and write the Following Code


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

        private void Form3_Load(object sender, EventArgs e)
        {
            lblDispaly.BackColor = Color.Yellow;
            lblDispaly.ForeColor = Color.Blue;
        }
    }
}



Output :-





No comments:

Post a Comment