I have 2 forms: a main form and a second form with only a listview in which users can make a selection. Once the listview item is activated with a double click, I want a label on the main form to display the text of the item that was activated. Here is my code (not working); why is this wrong? Thanks
Main Form:
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
/* for populating the process list when the user clicks display process button */
private void DisplayProcessButton_Click(object sender, EventArgs e)
{
Process_List plopen = new Process_List();
plopen.Show();
Process[] process = Process.GetProcesses();
foreach (Process prs in process)
{
plopen.listView1.Items.Add(prs.ProcessName);
}
}
Second Form:
private void listView1_ItemActivate(object sender, EventArgs e)
{
MainForm mf = new MainForm();
mf.label1.Text = e.ToString();
Close();
}