-2

I'm stuck in a problem in windown form (C#). I have MainUI form consist of a DataGridView, that contains data in my database and a button called BtnRegister. And I have Register form containing some TextBoxs, CheckBoxs... and a confirm button. When I click BtnRegister, Register form is shown and I can input data by typing in textboxs, ... and confirm data inputed by clicking confirm button. The problem is that I dont known how to add a new row into DataGridView in MainUI form by clicking confirm button in Register form. enter image description here

Sorry, my English is not good. But I have a significant hope that some one can help to solve this problem. Thank you.

  • You need a reference to the other form, often passed out in the show&constructor and to make the dgv public. There are a million duplicates around..Several ways are in the link, – TaW Aug 03 '18 at 06:46

1 Answers1

-1

Just observe the dialog result in your main form. For example:

If (register.ShowDialog() == DialogResult.OK)
{
    dataGridView.Add();
    // do something
}