Thursday, 29 November 2012

C# RadioButton Control

Use Of C# RadioButton Control : 

           RadioButton Control Allow User To Choose Single Items From List Of Items.

Important Property Set Of  RadioButton Control From Property Window :

               Text : Represent String, That String Display With RadioButton Control.

               Checked : True/False, If You Set True Then RadioButton Control Display With Checked Mark.

 

Code To Display User Selected Favourite Bird In Label Control When User Click On Button

 

        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                label1.Text = "Your Favourite Birds : " + radioButton1.Text;
            }
            if (radioButton2.Checked == true)
            {
                label1.Text = "Your Favourite Birds : " + radioButton2.Text;
            }
            if (radioButton3.Checked == true)
            {
                label1.Text = "Your Favourite Birds : " + radioButton3.Text;
            }
        }

Output :

.net Examples

 

C# CheckBox Control

Use Of C# CheckBox Control : 

           CheckBox Control Allow User To Choose Multiple Items From List Of Items.

Important Property Set Of  CheckBox Control From Property Window :

               Text : Represent String, That String Display With CheckBox Control.

               Checked : True/False, If You Set True Then CheckBox Control Display With Checked Mark.


Code To Display User Selected Color In Label Control When User Click On Button

 

        private void button1_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
            {
                label1.Text = label1.Text + checkBox1.Text;
            }
            if (checkBox2.Checked == true)
            {
                label1.Text = label1.Text + checkBox2.Text;
            }
            if (checkBox3.Checked == true)
            {
                label1.Text = label1.Text + checkBox3.Text;
            }
        }

Output :

 

C# Label Control

Use Of C# Label Control :

                    Label Controls are Used to Display Text and cannot be modify by the user. They are used to identify objects on a form.

Important Property Set Of  Label Control From Property Window :

               Text : Represent String, That String Display With Label Control.

 

Code To Merge Label Control Text With Textbox Text When User Click On Button

 

private void button1_Click(object sender, EventArgs e)
{
      label2.Text = label2.Text + textBox1.Text;
 }


Output :


 

C# Textbox Control

Use Of C# TextBox Control :

                        A text box is a Windows control used to get or display text to the user.

  Important Property Set Of Textbox Control From Property Window :

               Text : Represent String, That String Display With TextBox Control.

 

Code To Display MessageBox With Textbox Text When User Click On Button

 

private void button1_Click(object sender, EventArgs e)
{
       string s = textBox1.Text;
       MessageBox.Show("Message : " + s, "Message");
}


Output :