-2

I'm coding in c#.

I am creating an array of objects in the first form.

I want to open up a second form that displays the information in the array in a listbox.

How do I pass the information in the array in the first form to a new array in the second form?

Edit:

This is the code I have in the first form.

f2.F2People = people;

F2People is the properties of the f2people array in the second form. (the array is private, so you would use the properties to set a value). people is the array in the first form. I have this code inside the button click.

hatz
  • 225
  • 1
  • 4
  • 13

2 Answers2

1

Override the constructor of the second form, pass in your array, and store it in a variable. Then during the form load event of form two, load your list box.

Kye
  • 5,919
  • 10
  • 49
  • 84
0

I have answered something similar at

Passing data between forms on form closing

if this works for you I can easily ports this to C#.

Community
  • 1
  • 1
jcwrequests
  • 1,132
  • 1
  • 7
  • 13