form的closing事件为何触发2次?
程序如下,我发现点了这个菜单以后,closing事件响应函数执行了2次,
不知道为什么?
谢谢。
private void menuItem1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
void ContactsForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//throw new System.Exception("The method or operation is not implemented.");
for (int i = 0; i < listView1.Items.Count; i++)
{
if (listView1.Items[i].Checked == true)
{
ListViewItem lviContactItem = listView1.Items[i];
m_arrayContacts.Add(lviContactItem.Clone());
}
}
}