Button buttons
TextBox text Box Event TextChanged
Label label
CheckBox check box
private void textBox1_TextChanged (object sender, EventArgs e)
{
if (TextBox1.Text = = "123") TextBox2.Text = "Xiao Ming";
else TextBox2.Text = ("Password error");
}
Password Display Name
check box in the code
private void Checkbox1_checkedchanged (object sender, EventArgs e)
{
if (checkbox1.checked = = True && checkbox2.checked==true)
TextBox3.Text = "I like" + Checkbox1.text + "and" + checkbox2.text;
else if (checkbox1.checked = = True && checkbox2.checked = = False)
TextBox3.Text = "I like" + Checkbox1.text;
else if (checkbox1.checked = = True && checkbox2.checked = = False)
TextBox3.Text = "I like" + Checkbox2.text;
else if (checkbox1.checked = = True && checkbox2.checked = = False)
TextBox3.Text = "";
}
private void Checkbox2_checkedchanged (object sender, EventArgs e)
{
if (checkbox1.checked = = True && checkbox2.checked==true)
TextBox3.Text = "I like" + Checkbox1.text + "and" + checkbox2.text;
else if (checkbox1.checked = = True && checkbox2.checked = = False)
TextBox3.Text = "I like" + Checkbox1.text;
else if (checkbox1.checked = = True && checkbox2.checked = = False)
TextBox3.Text = "I like" + Checkbox2.text;
else if (checkbox1.checked = = True && checkbox2.checked = = False)
TextBox3.Text = "";
}
Add the RadioButton radio button code using the following:
private void Radiobutton1_checkedchanged (object sender, EventArgs e)
{
if (radiobutton1.checked = = True)
Textbox4.text = "I am very" +radiobutton1.text;
{
}
}
private void Radiobutton2_checkedchanged (object sender, EventArgs e)
{
if (radiobutton2.checked = = True)
Textbox4.text = "I am very" + radiobutton2.text;
}
}
ListBox list Box
Find Items Property Point Open Collection
Display the String Collection Editor
Writing code
private void listBox1_SelectedIndexChanged (object sender, EventArgs e)
{
Textbox5.text = "You like the first" + listBox1.SelectedIndex.ToString () + "kind of color:" +LISTBOX1.TEXT;
}
}
Combo Box combobox
The DropDownStyle property controls the appearance and functionality.
There are simple, dropdown,dropdownlist 3 options
Common events
Leave occurs when the control is no longer the active control of the form.
SelectedIndexChanged changing the Selectedindew property of a control occurs
First, enter the items collection to write the string
Then the code runs
private void ComboBox1_SelectedIndexChanged (object sender, EventArgs e)
{
if (Combobox1.selectedindex = = 0) Textbox6.text = "Aries";
else if (Combobox1.selectedindex = = 1) textbox6.text = "Taurus";
else if (Combobox1.selectedindex = = 2) Textbox6.text = "Gemini";
else if (Combobox1.selectedindex = = 3) Textbox6.text = "Crab seat";
else if (Combobox1.selectedindex = = 4) Textbox6.text = "Lion";
else if (Combobox1.selectedindex = = 5) Textbox6.text = "virgin";
else if (Combobox1.selectedindex = = 6) Textbox6.text = "balance";
else if (Combobox1.selectedindex = = 7) Textbox6.text = "Scorpio";
else if (Combobox1.selectedindex = = 8) Textbox6.text = "Shooter";
else if (Combobox1.selectedindex = = 9) Textbox6.text = "Magic scorpion";
else if (Combobox1.selectedindex ==10)
Textbox6.text = "water bottle";
else if (combobox1.selectedindex ==11) textbox6.text = "Pisces";
}
}
}
ToolTip tooltip
Windows Foundation controls use