其中两道:
1.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
comboBox1.Items.Add("1");
comboBox1.Items.Add("2");
comboBox1.Items.Add("3");
comboBox1.Items.Add("4");
comboBox1.Items.Add("5");
comboBox1.SelectionChangeCommitted += new EventHandler(ComboBox1_SelectionChangeCommitted);
}
void ComboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
Console.WriteLine("SelectionChangeCommitted called");
}
} When is ComboBox.SelectionChangeCommitted called?
a. When pressing up or down to select a new item in the ComboBox.
b. When selecting a new item in the combobox with the mouse.
c. When typing matching text into the text area and pressing enter.
d. a and b.
e. b and c
f. All of the above
2. Which one of the following is NOT a proper way of assigning a method to an event?
a. btnSubmit.Click += new EventHandler(btnSubmit_Click);
b. bnSubmit.Click += new EventHandler(delegate { });
c. btnSubmit.Click += delegate { };
d. btnSubmit.Click += new EventHandler(delegate(object sender) {});
e. btnSubmit.Click += new EventHandler(delegate(object sender, EventArgs ea) { });