flipnjme

flipnjme

  • NA
  • 15
  • 0

values on form1 goto null when form2 is opened

Jun 25 2004 1:12 AM
Im trying to get a value from form1 and use it in form2. If I set a breakpoint right before form2 is loaded the value is set to a drive letter after form 2 loads it goes to null. this is the code im using to open the form: public void GetFileInfo() { Form2 dlg = new From2(); dlg.ShowDialog(); } and this is the code for onload for form2 private void Form2_Load(object sender, System.EventArgs e) { Form1 frm1 = new Form1(); DirectoryInfo di = new DirectoryInfo(frm1.DrvLtr); FileInfo[] fiArr = di.GetFiles(); foreach(FileInfo fi in fiArr) { textBox1.Text = fi.Name; } } any help with this would be greatly appreciated.

Answers (3)