I'm making a fairly simple inventory program, and I'm stuck as to how I can add data to the original main form.
On the main form, I have a button to add an item and it's details (additem). Once the user clicks the "Add" button, it should put the entered info into one of four DGV's on the main form. This works fine, however, every time a new item is added, it is added in a new instance of the main form, and the previous instance (with the previous item entry), gets thrown out.
Here is the code for the "Add Item" button on the main form:
additem form1 = new additem();
this.Hide();
form1.ShowDialog();
this.Visible = true;
this.Refresh();
And here is the code for the additem form when the user clicks "Add":
invmain invmainobject = new invmain();
//Work done here...
this.DialogResult = DialogResult.OK;
invmainobject.Show();
How do I get the information to appear on the original instance and update the form so the new entries appear in the DGV's?