Best practice to pass information between windows.forms

后端 未结 6 394
误落风尘
误落风尘 2020-12-19 15:42

What do you do to pass information between forms? Forward is straight forward (sorry) using Properties or maybe parameters in a New() or DoStuff() method, but what about se

6条回答
  •  一向
    一向 (楼主)
    2020-12-19 16:24

    Create public properties for the form, then wait for the form to close and check the properties before disposing the new form.

    NewForm myForm = new NewForm();
    myForm.ShowDialog();
    string x = myform.MyProperty;
    

提交回复
热议问题