I got a Windows form that is trying to transfer the value from this form to a new one when the button is clicked. via:
private void Edit_button_Click(object sender, EventArgs e)
{
for (int i = 0; i < listBox1.SelectedItems.Count; i++)
{
Edit item = new Edit(int.Parse(listBox1.SelectedIndex.ToString()));
item.ShowDialog();
}
}
When I run the program, it does not show the form I created, it shows it instead

But when I change the code to this:
Edit item = new Edit();
item.ShowDialog();
run it, it will display the correct thing, but does not pass the value to the second form.

Is there a way to pass the value to another form?
source
share