Hello all,
I use this but i get an error.
private void button1_Click(object sender, EventArgs e)
{
// When i use this,
// -------------------------
// Form1 frm1 = new Form1();
// frm1.ShowDialog();
// -------------------------
// This works for sure...
// But i don't wanna open that already open form one more time.
// So i use as u see it below.
Form1 frm1 = (Form1)this.Owner;
int MyTotal, a, b;
a = Convert.ToInt32(TxtPrice.Text);
b = Convert.ToInt32(TxtQty.Text);
MyTotal = a * b;
frm1.dataGridView1.Rows.Add(TxtName.Text,TxtCode.Text,TxtPrice.Text,TxtMt.Text,TxtQty.Text,MyTotal);
this.Close();
// But i get error and it says:
// System.NullReferenceException: 'Object reference not set to an instance of an object.'
}
anybody can tell me why this doesn't work ? Thank you in advance.