请帮助我解决此错误! [英] Help me to solve this error, please!

查看:81
本文介绍了请帮助我解决此错误!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


朋友,我正在使用C#窗口应用程序.我设计了表格,但出现错误.

Hi
Friends I am working on c# window application. I have designed the form and in that I am getting an error.

public partial class Home
{
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    public override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }
}


这是代码.我在Dispose(布尔处理)时遇到错误

我收到的错误是:
``MIC.Home.Dispose(bool)'':没有找到适合的方法来覆盖C:\ Documents and Settings \ Administrator \ Desktop \ Aarti \ MIC Project \ MIC \ MIC \ Home.Designer.cs

我没有解决该问题的方法,请帮忙

在此先感谢:rose::rose::thumbsup:


This is the code. I am getting error at Dispose(bool disposing)

The error I am getting is:
''MIC.Home.Dispose(bool)'': no suitable method found to override C:\Documents and Settings\Administrator\Desktop\Aarti\MIC Project\MIC\MIC\Home.Designer.cs

I am not getting how to solve this please help

Thanks in Advance :rose: :rose: :thumbsup:

推荐答案

嗨Aarti,

尝试这些链接将对您有所帮助.

http://msdn.microsoft.com/en-us/library/system.idisposable.aspx [^ ]

http://bytes.com/topic/c-sharp/answers/545282-using-generics-causes-dispose-erro [ ^ ]

干杯:)
Hi Aarti,

Try those links its will helpful to you.

http://msdn.microsoft.com/en-us/library/system.idisposable.aspx[^]

http://bytes.com/topic/c-sharp/answers/545282-using-generics-causes-dispose-erro[^]

Cheers :)


您的基类(无论是什么)都不是从IDisposable派生的.
Your base class (whatever it is) isn''t derived from IDisposable.


您似乎几乎一无所知继承和面向对象的编程.这就是为什么您既不理解编译器错误也不了解已经收到的很好答案的原因. 所以,我将向您介绍一个绝对的初学者:

Home class位于两个文件中:Home.cs和Home.Designer.cs.
在Home.cs中,您必须有这样的一行:
You seem to know almost nothing about inheritance and object oriented programming. That''s why you understand neither the compiler error nor the very good answers you already received.
So, I''ll talk to you as to an absolute beginner:

The Home class is located in two files: Home.cs and Home.Designer.cs.
In Home.cs you must have a line like this:
public partial class Home : SomeClass


这意味着您的Home class来自SomeClass.
现在,SomeClassIDisposable,即它实现了IDisposable interface,即它具有Dispose方法.如果它具有Dispose方法,则可以覆盖它.
但是问题在于,在Home.Designer.cs文件中,只有同一行代码(class定义):


This means that your Home class is derived from SomeClass.
Now, SomeClass is IDisposable, i.e. it implements the IDisposable interface, i.e it has the Dispose method. If it has the Dispose method, you may override it.
But the issue is that in Home.Designer.cs file, the same line of code (the class definition) is only:

public partial class Home


没有它真正需要的: SomeClass部分.

因此,简而言之:在此处添加! (您不应该首先删除它)


without the : SomeClass part it really requires.

So, to be short: Add it there! (You shouldn''t have deleted it in the first place)


这篇关于请帮助我解决此错误!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆