'WaitWnd.WaitWndFun' does not contain a definition for 'SetText' and no extension method 'SetText' accepting

Alvord, Timothy 236 Reputation points

I am trying to add a routine 'SetText' to a class. It shows up in the solution explorer:


But if I try and access that variable I get the error:

'WaitWnd.WaitWndFun' does not contain a definition for 'SetText' and no extension method 'SetText' accepting a first argument of type 'WaitWnd.WaitWndFun' could be found (are you missing a using directive or an assembly reference?

Here's the code that's trying to call it:

WaitWnd.WaitWndFun waitForm = new WaitWnd.WaitWndFun();  

and here's the metadata for the class:

#region Assembly WaitWnd.dll, v1.0.0.0  
// C:\Users\a3055389\Desktop\WaitforWnd_Sources\WaitWnd\bin\Debug\WaitWnd.dll  
using System;  
using System.Windows.Forms;  
namespace WaitWnd  
    public class WaitWndFun  
        public WaitWndFun();  
        public void Close();  
        public void Show();  
        public void Show(Form parent);  

Any ideas?

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,387 questions
0 comments No comments
{count} votes

Accepted answer
  1. Alvord, Timothy 236 Reputation points

    Finally figure it out. Not sure if there's an easier way to fix it, but I'll explain what happened and how I ended up getting it to work. So the one project/class that was giving me problems "WaitWnd,WaitWndFun" was taken from another solution I had build elsewhere and added to the solution I was currently working on. It looks like even though the entire project was copied into the new solution space on my computer, the locations of where the DLL were is still hard-coded into the ".csproj" file and no amount of Clean builds, re-builds or anything else changed the location in the ".csproj" file. I only happened onto the solution when I looked at the ".csproj" file in a text editor and noticed that it was getting the location of where to look for the DLL from the old solution's directory. So I changed the path to the new project, and reloaded the solution, re-compiled and everything worked fine. Here is the location within the ".csproj" file I modified:


    Was there a way to accomplish this within VisualStudio?

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,621 Reputation points

    Hi AlvordTimothy-4979,
    Based on your code which in the metadata for the class, the 'member function' must declare a body because it is not marked abstract, extern, or partial.
    The code is as follows:

    namespace WaitWnd  
        public class WaitWndFun  
            public WaitWndFun() { }  
            public void Close() { }  
            public void Show() { }  
            public void Show(Form parent) { }  
            public void SetText(String s) { }  

    Best Regards,
    Daniel Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments