这个是因为listview1中选中变化触发百事件的时机造成的
你先选度中A,然后去点B,当A失去知选中状态时,触发SelectedIndexChanged事件,这个时候,是没道有选中项的,然后B获得选中状态回,再次触发SelectedIndexChanged事件,这个时候选中项就是B了
事件顺序是答 ItemSelectionChanged--〉SelectedIndexChanged--〉ItemSelectionChanged--〉SelectedIndexChanged
if (this->listView1->SelectedItems->Count>0) //简而言之,这句话必不可少
{
this->textBox1->Text = listView1->SelectedItems[0]->SubItems[0]->Text;
this->maskedTextBox1->Text = listView1->SelectedItems[0]->SubItems[1]->Text;
this->maskedTextBox2->Text = listView1->SelectedItems[0]->SubItems[1]->Text;
this->textBox2->Text = listView1->SelectedItems[0]->SubItems[2]->Text;
}