I just can not understand how to refer to another object. Form 1 has a datagridView (ReadOnle = true), if the user does everything necessary on form 2, then the datagridView from the first form should change the ReadOnly property to False. Please help realize this.

    2 answers 2

    You do this in the first form - public void readOff () {datagridview1.readonly = false; }

    The second you call

    private void btn_add_Click (object sender, EventArgs e) {form2 f2 = new form2 (); f2.Show (this); // the link to the parent form is passed}

    Now in 2 form

    private void btnUpdate_Click (object sender, EventArgs e) {form1 f1 = this.Owner as form1; f1.readOff (); this.Close (); }

    I wrote from the phone, so litter for errors.

      Too little information. It all depends on how you work with the second form.

      If the 2nd form is called modally, then after it is closed, you can do checks. According to the results of which, activate the table.

      If the form is not modal, again, either hang the event at the close, and make checks after closing. Or, through the constructor, you link the 2nd and 1st forms, and in the 2nd, according to the results of the checks, activate the 1st table.

      In general, these same methods are 1 million + 100,500. And which one to use is already a matter of your imagination.