I want to transfer data from Form2
into Form1
's listBox1
. Form2
includes several textboxes,
I have tried to face this problem by placing all of this code into Form1
but I cannot get the values needed from Form2
.
Can anybody help, I understand I'm not very clear but I can answer any questions about the code.
private void button3_Click(object sender, EventArgs e)
{
List<Form1Other> FileList = new List<Form1Other>();
Form1Other[] f1Other = new Form1Other[10];
Form1 testForm1 = new Form1();
string TName = textBox1.Text;
string TDesc = textBox2.Text;
decimal TPrior = numericUpDown1.Value;
string TDate = dateTimePicker1.Value.ToShortDateString();
string TCompl = "UNFINISHED";
FileList.Add(new Form1Other(TName, TDesc, TPrior, TDate, TCompl));
testForm1.listBox1.Items.Add(FileList[0].tName);
testForm1.listBox1.Items.Add(FileList[0].tDesc);
testForm1.listBox1.Items.Add(FileList[0].tPrior);
testForm1.listBox1.Items.Add(FileList[0].tDate);
testForm1.listBox1.Items.Add(FileList[0].tCompl);
System.Diagnostics.Debug.WriteLine(FileList[0].tDesc);