Build ASCX user control

I want to know the proper way to Build/Publish a user control and then I want to use the control in an existing web app. I built a GridView control that I want to implement into this app and replace each of the grids in the app to use this new user control. I currently have the control in a Test app on a form but if I want to publish just the control(and the classes needed) without the form I have it on, how can I go about doing that? Should I take out all the code I need just for the control and create a new project and add everything I need and then do a build and publish it to the server, with the app I want to add it to, and use it like that? Ive never done this before so I want to do it the correct way.
FYI, I am using VS 2012 (VB code base) using .NET framework 4.0

Any help would be greatly appreciated....

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
Easiest way would be to create a project using a class library with just the user control (ascx) and the implementation (ascx.vb) for the user control.  You build that into a DLL, which you can then add to other projects as needed.  You could also add this to your toolbox in visual studio by adding the DLL (right clicking on the toolbox -> add items).  When you drag that into your main project, it should automatically add the DLL as a reference.
jknj72Author Commented:
>>"Easiest way would be to create a project using a class library with just the user control (ascx) and the implementation (ascx.vb) for the user control."

Are you saying to just add the user control to a project without the classes? I have 6 classes that handle all the functionality for the ascx? I hate to sound so needy but can you be a little more granular so I dont miss any steps?

1. Start a new web app project?
2. Add the ascx file(with or without the classes)?
3. Publish the app to the prod server where I want to use it? I need these steps as well....
4. Open the exsting app on the server and go to the toolbox and do the add item, and add the ascx to the forms I need
jknj72Author Commented:
also, what type of project should I use when I create the ascx project?
Kyle AbrahamsSenior .Net DeveloperCommented:
Are the classes specific only to the ASCX?

You should create a new class library  (windows -> class library) project.  I realize this is intended for the web but what you really want to build is a DLL that will have your control in it which can then be referenced by other projects.

You should add your classes as long as they are general.  When you're developing a new control your focus should be on the control's job is to do this, or I want developers to be able to do this.  It shouldn't be geared towards any one project in mind.

So as long as the classes are used in the user control are general than no issues adding them.  If you need each project to customize the class then make some functions overridable or fire events (eg: beforeSave event).  

Hope that helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jknj72Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.