Link to home
Start Free TrialLog in
Avatar of zaratin
zaratin

asked on

ListView SelectedItems

Hello all,

I'm trying to get item text out of selected item of a list view. Following event code works out once:

private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
{
   textBox1.Text=listView1.Items[listView1.SelectedIndices[0]].Text;
}

When selecting another item afterwards,  I get 'System.ArgumentOutOfRangeException'. Why?

Any hints are welcome!
ASKER CERTIFIED SOLUTION
Avatar of ptmcomp
ptmcomp
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zaratin
zaratin

ASKER

Thanks for your answer ptmcomp.