I recently tried to make a WPF application with Visual Studio 2013 (compiling against .NET 4.5) . I wanted to draw something on a canvas. But the method doesn't work.
private void drawSomething(Graphics g)
I took some old code I used with Windows Forms when I noticed that my Graphics wasn't found anymore. First I thought I forgot the using directive but I used
using System.Drawing;
Still Graphics couldn't be found. I was reading on the web that some people had to add a reference to the project. I did this and added the reference manually. Still it doesn't work.
So I start wondering. Has this changed? Haven't used C# for a while.
Hopefully someone knows what to do.
In visual Studio, you can right click on Graphics and then choose the option named 'Resolve' The IDE will list you available assemblies for you to import one of them.
If you can't see the RESOLVE option, figure you need to add a manual reference to your project...
Related
It is my first time using visual studio 2019. So, I wanted to use the Clipboard class. In order to use the clipboard class, it looks like I have to add a reference, then import using System.Windows.Forms. However, when I right-click on the solution area, then press add reference, it just gives me an empty page.
So, I searched up the problem and people fixed the problem by enabling codelens. However, I found that there were no codelens for mac.
How can I fix the problem with the add reference?
Also, I wanted to know how to import the Clipboard class or if I was doing it right?
Windows Forms is not supported on macOS, so you won't be able to use that class.
Either you use Xamarin.Essentials or use the native NSPasteboard.
I've found a nice VB.NET Theme online, however, my application was C#, so I did the most logical thing, which is creating a new VB.NET Class Library, using the theme class, and then using the DLL through my toolbox's items.
This is the theme's code: http://pastebin.com/bxM7wtyN.
Note that the classes were not set to public, but I did so, as I thought that's why the error popped up. This is the error I'm getting.
Why's that, exactly? I think everything looks fine, and the theme's code works for everyone as they're using VB.NET, but not for me.
Uh, You have 2 ways. Find a c# version or try to convert into c# from vb.net.
Try adding the code to a blank file in your project, and then build the project but don't run it. Now in Visual Studio, open the Toolbox and the new controls should be at the top.
I am using the MagicLibrary for a few components. I knew it was written in Visual Studio 2003 and recompiled it in Visual C# Express 2010. It compiled just fine and I could see the library in the folder.
I then created a new project in Visual C# Express 2010 and added the components MagicalLocalLibrary.dll to the Toolbox. They appeared fine with no errors. I put in a control from the Toolbox to my form, and it seemed fine. I then debugged (to see if any errors would occur) and I saw that the reference MagicalLibrary disappeared and I got the error:
The type or namespace name 'Crownwood' could not be found (are you missing a using directive or an assembly reference?)
The thing is that, the reference shows fine under References in Solution Explorer but I can't import it with using or use it in the code (simply is not listed in InstelliSense either) but if i go into the Object Browser and choose "My Solution" it is not listed. I can click on the Reference in Solution Explorer and just change the Copy Local property to True or False, then it will appear in the Object Browser but whenever I debug my project again it disappear.
Any idea why it does this? Thanks in advance.
Check that you are using the .Net 4 framework and not the client profile version
You find that setting when you right-click on your project, choose properties. And under application there is a setting for target framework. If you have chosen the .Net 4 framework Client Profile, then this behavior that you described can happen
I ran into a very similar issue once. In my case the problem turned out to be a missing dependency for the "vanishing" namespace's assembly. What finally gave me the information I needed was the suggestion in this StackOverflow answer to raise the MSBuild output verbosity level. After raising the verbosity setting the IDE should give you a more specific reason why the compilation fails.
I have a Content Project for an XNA game, but I'm embedding the game inside a WinForm so I'm not actually using the Microsoft.XNA.Framework.Game class.
How can I make the Content project build with the WinForm's project? I tried adding it as a reference, but the Project isn't listed to be added.
To make it clear, I have two projects in my solution:
KinectGraphics
XNARenderContent
How can I make XNARenderContent build along with my KinectGraphics' project?
As you are using a WinForms application, can I draw your attention to this article.
You can change the Build Order if this is causing you a problem.
If you are struggling to get the Content project in your WinForms application as a reference, then I would definitely take a look at the link above.
this is a very newbie question, sorry!
I need to create an aspx website based con C# and am calling some webservices based on some DLL's I already have. Beforem purchasing Visual Studio, I decided to try Microsoft Visual Web Developer Express (is this ok?) creating a Web Application ASP.NET based on Visual C#.
I created the form to enter the data which is submitted when clicking the process button. At this point I need to call stuff from the DLL, which I have added in the Solution Explorer via Add Reference, selecting the DLL from the COM list. But whenever I run the project, I always get the error "the type or namespace xxx cannot be found - maybe a using directive or assembler directive is missing" when trying to create the object.
What is my stupid mistake?
Thanks!
If you look at the error message, there is another half that you havent covered. At the top of each code file that you want to use the namespace from your DLL, you need to include a "using directive" to let the compiler know that it may be linking to that DLL during compilation. Basically the compiler is wondering where something is, and even thoguh you included it in the function, you didnt take the final step of adding in the using statement at the top of the file.