I'm a PLC programmer (mostly industrial automation using Ladder Logic) who has picked up some other programming skills along the way. Went back to school, learned some basic C and java, etc. But I'm a bit baffled by the Visual Studio IDE for C#. I'm brand new to this, so please forgive my ignorance.
I have two sample applications and I've been assigned with trying to make one look/behave more or less like the other. The "working" application, when I open it in VS 2019, has a customized section of the VS toolbox. The toolbox contains all of the User Controls that appear in the "Parts" folder of the VS solution. This allows me to drag and drop these controls into a Form and it auto-generates the code. Nice.
However, on the other sample project (which is very similar) nothing from the "Parts" folder appears in the Toolbox. So I can't drag and drop the Use Controls into the forms I'm trying to build.
Not sure if it matters, but I'm running the apps on two separate PCs so I can compare easily. Both are running brand new installs of VS 2019. I mention this because I didn't do any custom setup of the IDE. So the fact that these items from the Parts folder appear in the VS Toolbox seems to be a function of the solution itself, not the IDE.
So that's my question: How do I get things from the Parts folder into the VS Toolbox so I can drag them into a form?
Any advice would be appreciated.
Thanks,
$$$
Found it. Compile the project successfully and anything that appears in the "Parts" folder will automatically appear in the toolbox under a new heading with the same title as your project.
https://learn.microsoft.com/en-us/visualstudio/workflow-designer/how-to-add-activities-to-the-toolbox?view=vs-2019
$$$
Related
I'm starting with the Head First C# book and right off the bat I can't get my screen to look like how it looks in the book. It wants me to open Visual Studio, create a new Windows Forms Application and the picture they have shows Design View which has a blank form in the center and on the left, there's a Toolbox with bunch of windows form items to drag to the center, such as pointer, button, checkbox, label, listbox, etc. When I'm searching online how to get this Design View, everyone says select the form in the solution explorer and either right click and select Solution Designer or click Shift+F7. All this does is goes to the code in the center of the screen. How do I get to see the visual part of the form instead of just the code?
The .NET Core implementation of Windows Forms does not include a designer by default as it is still a preview feature.
The instructions to install the preview designer can be found here:
https://devblogs.microsoft.com/dotnet/introducing-net-core-windows-forms-designer-preview-1/
Alternatively, and more likely what you want to do is use the full .NET Framework for your Windows Forms application.
To do this, when creating the project in Visual Studio there will be a project type called 'Windows Forms App (.NET Framework)'
I had a similar issue. It turns out I was opening the Folder my program was in and not the Solution file. When I opened solution, it worked as expected.
EDIT: This is from right-clicking the .cs file in Solution Explorer. The Shift + F7 also doesn't work if you opened it as a folder rather than a solution.
It seems to me that the Default blank app from Visual Studio is not at all a blank app.
It comes with a ton of files including some xml files. When I think of a Blank App I imagine a solution without files at all. And then you can go and create your first class and so on. But in Visual Studio there it seems it doesn't behave like this. Is this just the way of the C# Environment in Visual Studio ? Or is there a way to create a real blank App?
I observe that even the Assets folder is filled with Images in the Blank App.
If you create a new Project in Visual Studio you are using Templates.
If you want the 'rocky' from scratch process just select the Empty Project.
But I won't recommend this!
The purpose of this given templates is to avoid errors, common mistakes and preventing of repeating your self. Also to setup the right hooks for debugging in the Visual Studio IDE.
Especially Universal Apps need a lot of configuration. So why trying doing all by yourself and spend a lot of hours of reading and trying if you can have the whole process in second?
I am using VS 2013 (Express Version) and I want to create a WPF user Control Library project. But I am not able to find the template in my installed templates list. If I use Winforms, I am able to build a DLL out of my Winforms Application Project just by changing the Output type as "Class Library". But it is not happening in WPF and it is throwing errors if I do so. Is this the correct method of doing it or am I going wrong?
And in the Create New Project dialogue window, I am not able to find the .NET Framework selector drop down. After creating the project only I am able to change the .NET framework version by going inside the properties of the project.
Kindly help me to get out of this. Thanks in advance.
I have been working on this exact same problem for hours this morning. Here is what I think I have learned:
With Visual Studio Express 2013, it is by design that the WPF User Control Library template is not available for making a New Project. This is because it is the free Express version.
With the Express version, you don't have a "devenv.exe" for trying the "devenv /installvstemplates" to "fix" things. It is, instead, called (just a moment while I look this up again...) "WDExpress.exe" and will be located (if you have default location) in the "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" directory. BUT - this won't help you. It won't fix your problem, because, as I mentioned, your Express installation is designed to not have that template available for New Project, so your "fix" won't put it there. I know this because this is what I tried myself. (Also, note that the instructions for doing this tell you to uninstall any extensions you've installed before doing it. And then, of course, if you still want them you have to reinstall them. Like I still have to do, incidentally.) I'm letting you know all of this so you don't go through the headache I'm having.
Note that I have not done this yet, so this is somewhat hypothetical on my part, but is based on my research on the Internet so far - Your solution is to create a WPF User Control Library manually [but now see UPDATE below]. (No, I don't know how to do this yet. I got into this in the first place, because I'm a WPF novice - just started working with it a few days ago - and late last night I got this great idea to add a "spinner" progress indicator to my "WPF play/learning project" I'm working on, and found a couple of relatively easy-to-work-with samples on the Internet - both of them are a WPF User Control Library - and at first I wanted to use the copy-and-paste to put the code in. But then I discovered... well, our mutual problem, because I'm using Visual Studio Express 2013. No such template under New Project. And literally at the tail end of my about-to-throw-in-the-towel, I'm googling and your post, Dhivakar, is already showing up with the right Google search.) So I haven't finished my research yet, but my next step is to learn exactly how to create a WPF User Control Library manually (the code and various project property settings), and then I can just save a WPF User Control Library skeleton for future use and document the details.
UPDATE: This guy totally has the solution for Express versions. I have followed his steps and it works great. The only additional piece of information I would add is that in my version (VSE2013), after you've created your WPF User Control Library template, when you open Visual Studio again and use File -> New Project, my selection in the tree (for a Windows app) came up under Templates -> Visual C# -> Windows (which is what I've been using). I did not see my template showing up there, after I created it, and I thought, "Great! Another piece of advice that doesn't work." But then I clicked up one on the "Visual C#" parent - and there was the template!
Here you go:
How to add a WPF control library template to Visual C# Express 2008
https://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/
Yes, it works this way for VSE2013 too.
UPDATE 2: I'm not absolutely positive about this, but I think he missed one little piece. In his step #4 he says to delete Window1.xaml and App.xaml. Maybe this didn't apply with VSE 2008, but in VSE 2013 there is also the App.config file which I believe is extraneous for our purpose. So you can delete App.config as well. As I said, I'm not absolutely certain about this yet, but I noticed that file in the project when I added a WPF User Control Library project to my solution, and I deleted it, and the solution compiled okay.
Try running devenv with the /installvstemplates switch, from https://msdn.microsoft.com/en-us/library/vstudio/ms247116(v=vs.100).aspx
If this doesn't work, browse to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\WPF\1033\WPFUserControl (this could change dependent upon your installation directory), open the .vstemplate file in a text editor, and make sure the setting is set to true, then try running devenv with the switch again.
Hope it helps.
I am using MS VS 2010.
I can not for the life of me find any instructions on how to install something like this to use on Microsoft Visual Studio 2010.
I was wondering how to install and use this control in this version of MS VS with C#.
http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
I am making a very dynamic page with a lot of post backs and I think this has great potential!
I need to know how to get this one working bolded below:
Download (V2.2):
The sourcode is available in C# as a VS.NET project (Wont convert for
me)
A ready-to-use assembly (including help file). A demo shows the usage of this control. Sourcecode for this Demo (C#) or Sourcode for
the Demo (VB)
Any help would be greatly appreciated I can't find much information on this on the web. Perhaps I am using the wrong keywords... I am stuck on this at work for the time being and no-one here can help. Its become one of those aggravating programming moments were the fun is wearing off!
I saw one other post on here "Install Custom Control in VS Toolbox" But he too has no luck and I wasn't really looking to install it with a program. I swear I did this long ago with 2008 in college just through a process with MS VS.
Thanks
You need to store the assembly somewhere (we usually store them in an assemblies folder relative to the project), then add a reference to that assembly.
If the assembly supports being added to the toolbox, you can drag the assembly from windows explorer and drop it on the toolbox and it will automatically add all of the appropriate designable items to the toolbox. It is best, if you do this, to create a new tab to hold these items (right-click in the toolbox and select Add Tab).
If the assembly does support addition to the toolbox, your next step is to drag the item from the toolbox onto the page or control and visual studio should take care of wiring it up.
Otherwise, you will need to follow the instructions on the website or copy details from the sample projects to configure the control in your page.
A major part of our work is creating and manipulating certain XML files, for which have a custom editor. The editor is starting to get creaky and we are looking at building a replacement. Since VS2010 has recently arrived, ostensibly with an improved add-in architecture (MEF?), I am interested in the possibility of building the editor as a custom editor within Visual Studio.
It would have to appear in the same way as the code editor or the Designer - a tab item, of which there can be many open at once, containing the GUI we use to edit the files. It would integrate with VS's Edit menu. It could use the output window to display messages. It would appear the same as any other editor within Visual Studio.
Right now, I am looking for examples of add-ins that work in a similar way - ideally with source code - to see whether this model would suit our requirements. I am also looking for any documentation or tutorials relevant to creating a VS2010 add-in, or information about VS2008 add-ins if this is still relevant.
Any input is welcome. Thanks!
You want to look at the Managed Extensibility Framework for VS 2010. Since 2010 is written in .net you can create add on components using it.
Code editor extension for VS 2010.
Working with MEF
Custom Editor Extensions
Update:
Since someone asked in a comment, I thought I would post this link on creating add ons for vs 2008: http://msdn.microsoft.com/en-us/vstudio/bb968855.aspx