Wednesday, 26 June 2013
Tuesday, 5 March 2013
C# ComboBox Select Item
private void button11_Click(object sender, EventArgs e)
{
comboBox1.SelectedIndex = 1;
}
Tags : 1. C# .net ComboBox Control Examples - Select One From C# Combobox and set it as default item.
2. C# .net ComboBox Control Examples - Select Particular Item From C# ComboBox.
C# ComboBox Dynamic Add Item
private void button11_Click(object sender, EventArgs e)
{
ComboBoxItemAdd item=new ComboBoxItemAdd();
item.Text="New Item";
item.Value=2;
comboBox1.Items.Add(item);
}
public class ComboboxItemAdd
{
public string Text { get; set; }
public object Value { get; set; }
public override string ToString()
{
return Text;
}
}
Tags : 1. C# .net ComboBox Control Examples - Dynamic Add Items In C# comboBox
2. C# .net ComboBox Control Examples - Dynamic Insert Item In C# comboBox
3. C# .net ComboBox Control Examples - Aadd Items to comboBox Programmatically C#
Friday, 1 March 2013
C# ComboBox Remove Particular Item
private void button1_Click(object sender, EventArgs e)
{
comboBox1.Items.Remove(comboBox1.SelectedItem);
}
Tags : 1. C# .net ComboBox Control Examples- Remove Particular Item From
ComboBox
2. C# .net ComboBox Control Examples- Remove Selected Item From
ComboBox
Thursday, 29 November 2012
C# RadioButton Control
Use Of C# RadioButton Control :
private void button1_Click(object sender, EventArgs e)
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 :
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)









