As the topic states i want to use a streamwriter to write the listbox from form1, but the streamwriter is in form2. How do i get the data from form1 to form2?
I have the code to write everything out etc, all I need is help to get the data from form1 to form2, thanks.
You should make Form2 constructor take a ListBox as a parameter and then pass form1's ListBox as a parameter when initiating Form2.
An example:
When initiating Form2, pass that ListBox as a parameter:
Form2 form2 = new Form2([B]listBox1[/B]);
And edit Form2;s constructor:
// This will hold the listbox from Form1
ListBox listBox1;
public Form2(ListBox L)
{
InitializeComponent();
// Now this holds form1's listbox
listBox1 = L;
}