Use Of C# RadioButton Control :
private void button1_Click(object sender, EventArgs e)
Thursday, 29 November 2012
C# CheckBox Control
Use Of C# CheckBox Control :
private void button1_Click(object sender, EventArgs e)
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 :
private void button1_Click(object sender, EventArgs e)
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
Create Window Application
Drag Button Control From Toolbox And Drop On Form
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
We Create C# Window Application
Select Visual C# -> Windows Form Application
Name : Test
Location : D:\
Solution Name : Test
Subscribe to:
Posts (Atom)