locked
no suitable method found to override

    General discussion

  •  

    Hi, I am using web browser and i hit with the following error after copy and paste from microsoft msdn web app.

     

    Error 1 'WindowsFormsApplication1.Form1.Dispose(bool)': no suitable method found to override .

     

     Can any can tel me what  wrong?
    Tuesday, December 25, 2007 4:21 PM

All replies

  •  jbattat1 wrote:

     

    Hi, I am using web browser and i hit with the following error after copy and paste from microsoft msdn web app.

     

    Error 1 'WindowsFormsApplication1.Form1.Dispose(bool)': no suitable method found to override .

     

     Can any can tel me what  wrong?

     

    Change your statement that defines the Form1 Instance as:

     

    public partial class Form1 : Form , IDisposable

    {

    The method Dispose ( bool ) inherits from an Interface and has to be owerridden.

    Also the other statemetnshould be:

    'WindowsFormsApplication1.Form1.Dispose(true) // or false

     

    http://msdn2.microsoft.com/en-us/library/system.idisposable.aspx
    Wednesday, December 26, 2007 4:03 AM
  • Thanks but I am still receiving that error. But I forgot to state that I using C# Express 2008. Would that make a difference?

    Wednesday, December 26, 2007 2:57 PM
  • Sounds like you are trying to override a Dispose(bool) method in your class, but the parent class has no overrideable method of that signature. How about showing the relevant code so that someone may be able to help you better?

     

    Wednesday, December 26, 2007 4:55 PM
  •  jbattat1 wrote:

    Thanks but I am still receiving that error. But I forgot to state that I using C# Express 2008. Would that make a difference?

     

    Incidently, my code has compiled. My hunch is that a reference dll is missing in your Reference section. Can't even think of which one. My code was very simple.

    Wednesday, December 26, 2007 11:42 PM
  •  jbattat1 wrote:

     

    Hi, I am using web browser and i hit with the following error after copy and paste from microsoft msdn web app.

     

    Error 1 'WindowsFormsApplication1.Form1.Dispose(bool)': no suitable method found to override .

     

     Can any can tel me what  wrong?

     

    Are you trying to copy/paste code to create a form programmatically? 

    Yes?  If so, is this code being pasted onto an existing form, which was created by the designer?

     

    If you require more exact answers, please post your code block where the error occurs.

     

    Rudedog

    Thursday, December 27, 2007 5:57 PM
  • We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Monday, December 31, 2007 6:39 AM
  • hi,

    if you removed the namespace header in the code page, you can get this error message. 

    Monday, October 18, 2010 7:36 AM
  • I know this is old but this is a problem I had as a newbie Silverlight programmer and I felt that I should post this for anyone else who might be having this problem.

     

    I don't know the circumstances behind the original question but what I was trying to do was create a new web application from a silverlight navigation theme.  If you try to add a page from the'Project' 'Add' menu you can add a new page, and copy and paste the .xaml code to re-create the navigation menu.  It looks great until you compile and run the application and, upon attempting to navigate to your newly created page, you get an error.  While I was trying to fix this error I was playing around with the .xaml adding User Control, removing user control, adding user control to the coding, etc.  Trying a lot of different things.  When I added User Control is when I would get this error when trying to compile.

     

    The resolution to my problem was to create a class WITHIN the View folder of the solution explorer.  That is, open the solution explorer, right click on the 'Views', and select 'Add.'  I am very much new to Silverlight so I think what was happening is that the Navigation MainPage holds all of the theme elements (such as the buttons, the name, etc) and if you want to create other pages within that THEME you don't need an entirely new page you just need a new form FROM that MainPage theme.  I'm probably not doing a very good job of explaining this because I honestly do not know the exact cause (Like I said NEW) but I hope this bit of information helps any newbie programmers out who are googling the same questions I was googling.

     

    Thanks, and sorry for bumping a three year old topic.

    Thursday, October 21, 2010 2:37 AM