Attaching existing .cs file to windows forms application project
click on solution explorer.
Right click on project name, Add -> existing item.
Select the script you want to add.
In Form1.cs file mention following
using Namespace_of_attached_cs_file
Related
When creating a new project I can select a new Windows Forms Project. It will open me a new project with a new windows form. When right clicking my opened project and going for add => Windows Form it will only open the "new element" mask, where Windows Forms, WPF and other templates are missing.
I already tried Visual Studio C# Can't make new windows form project devenv /installvstemplates, but it didn't work out telling me the templates were missing.
The following files were passed with the commandline:
\installvtemplates
These files were not found and could not be load.
What do I have to do, to get my WinForm templates back and where can I configure those? I can not just reinstall Visual Studio 2013 Ultimate, because I do not have an installation medium nor they key (Like nobody in my company can tell where to find it).
In the screenshot below you can see the mask, where I used to have a lot more templates. In this case we only have Inherited Forms and Inherited User Control as avaliable templates.
This is what I get when I go for new project, Windows Forms is avaliable here.
( Win Forms Objects not avaliable )
The template files are avaliable at C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\VisualBasic so I am pretty sure it has to be an option somewhere in the settings. Any ideas?
After a few hours of trying I found a solution myself. It might not be the official way, but it seems to be working. I did the following steps:
Go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\VisualBasic and check if the templates are avaliable
If they are avaliable copy the directory Windows Forms
Paste the copied directory to C:\Users\%USERNAME%\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual Basic
Start Visual Studio
Go into a project and try to add a new element. This step will take a while loading. I think visual studio now detects the new templates in your documents folder and refreshes all templates.
When it has finished loading you will see almost all templates twice. That's good news!
Close Visual Studio and delete the directory in C:\Users\%USERNAME%\Documents\Visual Studio 2013\Templates\ItemTemplates\Visual Basic\ we just pasted.
Restart Visual Studio
Profit
Tested on Windows 10 / Visual Studio 2013 Ultimate
in my wpf project I added splash.png image to Resources and when the application run, works perfectly...
My question is: it's possible use the splash.png only in Release and not in Debug?
thanks in advance
You could try to manually edit the MSBuild script file as suggested here:
Debug-only classes and resources in visual studio - is it possible?
Right-click on the project in the Solution Explorer in Visual Studio and choose "Open Folder in File Explorer" and then open up and edit the .csproj file in a text editor such as Notepad. I am afraid Visual Studio provides no GUI that lets you do this though.
When I tried to create a class file in Windows Form in my Visual Studio it's creating .vb file and not .cs one. Not only in Windows Form but also in my MVC projects. Why it's creating .vb file? How do I change that .vb to .cs in all my projects. Did I select a wrong category while installing visual studio? If this question is not suitable to Stackoverflow.com can any one please migrate this question to appropriate Stack Exchange site.
Screenshot:
Because you started Visual Basic project.
In order to get files with .cs extension you have to create C# project solution.
You don't have to uninstall Visual Studio since it comes with "pre-installed" languages like VB.net, C#.net etc...
Re: Visual Studio 2010 Silverlight 4.0 project.
When setting the source for an image element using the builder from the property sheet, it Visual Studio has a handy option to add an image file to the project and set it as the source for the control.
The Problem:
Visual Studio wants to put those images in a folder called images off the root of my project, and will even create that folder if it doesn't exist. However, my project is structured so that the images should go in a different directory (assets\images). So I am always having to move them after using that builder.
The Question:
Is there a way to configure the project or change the default in Visual Studio such that the builder puts newly imported images in a different directory?
I don't think we can configure that. The best workaround for you would be to put a create a folder with all the images and add it to the project. From the Source property for Image control in the Properties window, you will able to select images from the "Choose image" dialog box.
I have a WinForms project in Visual Studio 2008, and I've created a Setup project for it. I can build this and it picks up the dependencies and creates the .exe and .msi. But I would like to customize it a little bit, for example by specifying my company name and changing the default 90s-style clip-art logo that appears when the installer executes. But I cannot find anything resembling a properties page where I would do any of this. If I right-click on the Setup project and go to Properties it just gives me options about the output file name, compression of the installer, etc.. Is there some other place I need to go to change things like my company name, the product name, and the image?
If you highlight the project, there will be new icons above the solution explorer.
These buttons are for the file system, registry, etc. Anything that is effected by the setup.