Is it possible to overload the ShowDialog method for forms and return a different result?

前端 未结 4 2525
渐次进展
渐次进展 2021-02-20 06:04

EDIT: This method actually works great and I asked it then found the solution later. I added the correct call in the overloaded ShowDialog() method (it\'s not exacly an over

4条回答
  •  盖世英雄少女心
    2021-02-20 06:16

    The ShowDialog method cannot be overriden. What you could do intead though is create a new method which returns both the ShowDialog result and another value.

    public ShowDialogResult ShowDialogWrappe(out MyFormResults result) { 
      var dialogRet = ShowDialog();
      result = MyFormResults.Result1;
      return dialogRet;
    }
    

提交回复
热议问题