小编Mik*_*hin的帖子

该方法或操作未实现

有两种形式.Form2源自Form1.

但是我在设计模式下遇到了Form2的问题,如下面的屏幕截图所示.

如果我对此发表评论this._presenter.Retrive();,它将正常工作.是怎么回事以及如何解决这个问题?

UPD: 如果我将删除throw new NotImplementedException(); 并将插入,例如,MessageBox.Show("Test");,每次我打开Form2时,MessageBox都会出现,就像我运行应用程序一样.

在此输入图像描述

窗体2

namespace InheritanceDemo
{
    public partial class Form2 : Form1
    {
        public Form2()
        {
            InitializeComponent();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Form1中

namespace InheritanceDemo
{
    public partial class Form1 : Form
    {
        protected IPresenter _presenter;

        public Form1()
        {
            InitializeComponent();
            _presenter = new Presenters();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this._presenter.Retrive();
        }
    }

    public class Presenters : IPresenter
    {
        public void Retrive()
        {
            throw new NotImplementedException(); …
Run Code Online (Sandbox Code Playgroud)

.net c# inheritance windows-forms-designer winforms

7
推荐指数
2
解决办法
5万
查看次数

如何以编程方式获取主Dns后缀?

如何在C#中以编程方式检索主Dns后缀?

C:\Users\jdoe>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : ABC-PC
   --->Primary Dns Suffix  . . . . . . . : mdanshin.co.za<---
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . …
Run Code Online (Sandbox Code Playgroud)

c# dns

5
推荐指数
1
解决办法
1256
查看次数

从文本中提取包含单词的句子

我有一个大文本。我需要在文本中找到任何单词,然后将包含该单词的短语复制到变量中。我怎样才能用 C# 做到这一点?也许我可以使用一些正则表达式?

c# regex

2
推荐指数
1
解决办法
1959
查看次数

标签 统计

c# ×3

.net ×1

dns ×1

inheritance ×1

regex ×1

windows-forms-designer ×1

winforms ×1