I have a file - open - openToolStripMenuItem in form1, and I have a listbox1 in form2, I want to open file from form1 (openfiledialog1) and then readwrite the txt file content into the listbox1 on form2. The only problem is that listbox1 does not exist in current context in form1, how do I get openToolStripMenuItem in form1 to see listbox1 on form2 ??? L public void openToolStripMenuItem_Click(object sender, EventArgs e) { FileInfo ReadFile = new FileInfo(@"c:\New Folder\BBBBOOOOO.txt"); StreamReader sr = ReadFile.OpenText(); while (!sr.EndOfStream) { listBox1.Items.Add(sr.ReadLine()); } }
public void openToolStripMenuItem_Click(object sender, EventArgs e)
{ FileInfo ReadFile = new FileInfo(@"c:\New Folder\BBBBOOOOO.txt");
StreamReader sr = ReadFile.OpenText();
while (!sr.EndOfStream)
{ listBox1.Items.Add(sr.ReadLine());
}