D
Dan =o\)
Hey guys,
I'm getting really annoyed with this array... After selecting some items
from a list view, I take the selected text from the first column and store
it in an array, I then pass this data back to the parent of this window,
which then takes this list (of filenames) and downloads them to a scanner.
I step through the child's array being filled with some paths of the data
that I selected in my list, then it all goes pear shaped. What's going wrong
is that when the the debugger steps back to the parent, and the selected
items array gets passed from the child to the parent, it's empty! From
stepping from ChildForm.cs "DialogResult = DialogResult.OK;" where my array
is populated with the data, to "m_SelectedItems =
frmPickListManage.SelectedItems;" where SelectedItems tells me my array has
a count of zero?!
Any help would be grately appreciated.
Thanks..
Dan.
//-------------------
// ParentForm.cs
//
// other code
//
FormPickListManagement frmPickListManage = new FormPickListManagement();
if ( frmPickListManage.ShowDialog() == DialogResult.OK )
{
ParentSelectedItems = frmPickListManage.SelectedItems;
DialogResult = DialogResult.OK;
}
else
{
DialogResult = DialogResult.Cancel;
}
//------------------
// ChildForm.cs
//
// other code
//
private ArrayList SelectItemsArray = new ArrayList();
public ArrayList SelectedItems
{
get
{
return SelectItemsArray;
}
}
private void button1_Click(object sender, System.EventArgs e)
{
//
// get the selected file list
ArrayList SelectItemsArray = new ArrayList();
foreach ( ListViewItem lvi in listViewPickingList.Items )
{
if ( lvi.Selected )
{
// text always returns with a filename and path as I expect
SelectItemsArray.Add ( lvi.SubItems[0].Text );
}
}
//
// get the main form to do the work
DialogResult = DialogResult.OK;
}
// NOTE: SelectItemsArray is not referenced anywhere else!
I'm getting really annoyed with this array... After selecting some items
from a list view, I take the selected text from the first column and store
it in an array, I then pass this data back to the parent of this window,
which then takes this list (of filenames) and downloads them to a scanner.
I step through the child's array being filled with some paths of the data
that I selected in my list, then it all goes pear shaped. What's going wrong
is that when the the debugger steps back to the parent, and the selected
items array gets passed from the child to the parent, it's empty! From
stepping from ChildForm.cs "DialogResult = DialogResult.OK;" where my array
is populated with the data, to "m_SelectedItems =
frmPickListManage.SelectedItems;" where SelectedItems tells me my array has
a count of zero?!
Any help would be grately appreciated.
Thanks..
Dan.
//-------------------
// ParentForm.cs
//
// other code
//
FormPickListManagement frmPickListManage = new FormPickListManagement();
if ( frmPickListManage.ShowDialog() == DialogResult.OK )
{
ParentSelectedItems = frmPickListManage.SelectedItems;
DialogResult = DialogResult.OK;
}
else
{
DialogResult = DialogResult.Cancel;
}
//------------------
// ChildForm.cs
//
// other code
//
private ArrayList SelectItemsArray = new ArrayList();
public ArrayList SelectedItems
{
get
{
return SelectItemsArray;
}
}
private void button1_Click(object sender, System.EventArgs e)
{
//
// get the selected file list
ArrayList SelectItemsArray = new ArrayList();
foreach ( ListViewItem lvi in listViewPickingList.Items )
{
if ( lvi.Selected )
{
// text always returns with a filename and path as I expect
SelectItemsArray.Add ( lvi.SubItems[0].Text );
}
}
//
// get the main form to do the work
DialogResult = DialogResult.OK;
}
// NOTE: SelectItemsArray is not referenced anywhere else!