i have a ListView sitting on a form in .NET.
Before the form is hidden the SelectedIncides are present and valid:
void buttonOK_click()
{
Assert(listView.SelectedIndices.Count > 0);
DialogResult = DialogResult.OK;
}
But after the modal form returns:
form1.ShowDialog();
Assert(form1.listView.SelectedIndices.Count > 0);
This 2nd assertion fails.
How do read the SelectedIndices of a ListView once the form the listview is on is hidden (although not destroyed/disposed/freed)?
You could try having a public var on form1 which holds a
List(or equivalent) of the selected indices? Have form1 set it on the form closing event. Once control is passed back to your original form you could just access that instead?