Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi
Friends I am working on c# window application. I have designed the form and in that I am getting an error.

C#
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);
    }
}

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:
Posted
Updated 14-Oct-10 2:32am
v6
Comments
Dalek Dave 14-Oct-10 5:04am    
Edited for Grammar.
Pawan Kiran 27-Oct-10 10:01am    
Create a Form and Send the Designer.cs and .cs Code

 
Share this answer
 
Comments
aayu 14-Oct-10 5:24am    
this links are not so help full see my code and error.
Your base class (whatever it is) isn't derived from IDisposable.
 
Share this answer
 
Comments
aayu 14-Oct-10 5:28am    
sorry but i am not getting you. This is my second form error and i am getting error in Home.Designer.cs
Nathan St 14-Oct-10 5:36am    
Aarti, what is the base class type of Home? If you don't know that, then you need to read up about inheritance and object oriented concepts.
CPallini 14-Oct-10 5:58am    
Aarti, to override the Dispose method, your class needs to derive from IDisposable, hence the compiler error.
aayu 14-Oct-10 7:14am    
@Cpallini : i have delete that form and i have created new form.
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:
C#
public partial class Home : SomeClass

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:
C#
public partial class Home

without the : SomeClass part it really requires.

So, to be short: Add it there! (You shouldn't have deleted it in the first place)
 
Share this answer
 
Comments
radix3 27-Oct-10 7:27am    
@Toli: very good and neat explanation
Toli Cuturicu 27-Oct-10 8:44am    
Thanks and if you like my effort, you may vote for it!
Pawan Kiran 27-Oct-10 9:58am    
your explanation is very clean and neat.
Here's the basic hierarchy;

Form class inherits from Container Control class.

Container control class inherits from Scrollable Control class and an interface called IContainer Control

Scrollable Control is inherited from Control class and two interface called IComponent and IDisposable interface

So your form named Home inherits from the Form class due to which it gets the Dispose method which is responsible for tasks such as freeing, releasing or resetting unmanaged resources.

What Toli said is quite true and is true because of this hierarchical structure that i have said here so even if you add this interface i feel it wont do any good to you because IDisposable interface is something what VS adds for you so in this case what you can do is try creating a new form and see what happens.

I too faced the same problem in one of my projects for C# and was searching for answers then did some home work and came to this conclusion.

I am not sure if adding IDisposible interface to the class may help but give it a try it did'nt work for me but if i does for you then surely tell me what process you followed.

Happy Coding
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900