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 :


 

C# MessageBox

Use Of C# MessageBox :

             Displays a message box that can contain text, buttons, and symbols that inform and notify the user.

 

We Create C# Window Application That Display MessageBox When User Click On Button

 

  1. Create Window Application

  2. Drag Button Control From Toolbox And Drop On Form

  3. Set Property Of Button Control From Property Window Like :

    Text = Hello Message

    Name = BTN_MSG

    4.  Generate "Hello Message" Button Of Click Event

 

               From Property Window Select Event And Double Click On "Click"


 5.  MessageBox Codding

 

private void BTN_MSG_Click(object sender, EventArgs e)
{
       MessageBox.Show("Hello Message", "Hello",MessageBoxButtons.OK,MessageBoxIcon.Information);
}

Here,
"Hello Message" Means Body Of MessageBox
"Hello" Means Title Of MessageBox
 MessageBoxButtons.OK Means Which Button Display On MessageBox
MessageBoxIcon.Information Means Display Information Icon With MessageBox

6. Run Program Press F5

 

7.  Output

Wednesday 28 November 2012

Create Window Application

  1. Open Visual Studio

Start -> All Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010

 

2. Create Window Application

  •     File -> New -> Project...

     

  •     New Project Dialog box Open

    1. We Create C# Window Application

    2. Select Visual C# -> Windows Form Application

    3. Name : Test

    4. Location : D:\

    5. Solution Name : Test


     

Open Visual Studio

How To Microsoft Visual Studio :

Start -> All Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010