Hello,
I am trying to pass some information to a new page, create a string array, and then use that information in additional code in the application. It seems to work fine until the last step, where the array values seem to disappear (goes null). Somewhere between when the new window closes and I am returned to the original code, I lose the information. I feel this is because the page closes and destroys the instance, so what remains is this: how do I pass the collected information from the second page to the first so that it remains there after I close the second page. I have detailed the process in the code below. Please let me know where I am making my mistake. Thank you in advance for your help, Pat
//Constructor from the Where page
public frmMain(ArrayList isChecked)
{
InitializeComponent();
this.checkedNames = isChecked; //This works perfect to here.
//The code then returns to close the window and then comes back
//to the scipt below
}
//******* This is where the code starts *********
private void buttonWhere_Click(object sender, EventArgs e)
{
for (int iItem = 0; iItem <= listViewColumns.Items.Count - 1; iItem++)
{
colNames.Add(listViewColumns.Items[iItem].SubItems[0].Text);
}
//Send the column names to the new window page for selection in a check list box
Where w = new Where(colNames);
w.ShowDialog();
//Page then goes to the windows page and the returns to the constuctor where the values
//have transfered correctly and propogated the Arraylist checkedNames correctly! The action then
//returns to the window page to close it and then comes back to this point.
//Return from the window page starts here
foreach (string name in checkedNames)
{
//At this point, the checkedNames Code has turned to null. It seems to have happened after the
//window page was closed. If that is the case, how do I get the values from that to this page
//so I can use the selected values in the code!!
}
}