VS : How to Add Component Class using C# in Visual Studio Express

Visual Studio Express is a lightweight version of VS products and although it is very powerful, it is missing several features from paid editions and one of them is ability to add a Component Class using Add New Item dialog box.

But users of Express editions can still create Component Class by following the steps below:

  • Using Add New Item dialog box, add a User Control and name it Component1 .
  • select Component1.cs and choose View Code to view the code. Now delete everything and replace it with the following code.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    namespace EmptyComponent
        public partial class Component1 : Component
            public Component1()
            public Component1(IContainer container)
  • Rename the namespace to the one you are using. Visual Studio will give your namespace same name as your project name.
  • Go to Component1.Designer.cs and remove the following line in InitializeComponent method. Method is located in Component Designer generated code region, so expand that region if necessary.
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

And you are done.

If you found this article useful, drop a comment or connect with the blog on the social networks.

One Response

  1. EdG
    March 7, 2014

Write a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.