How to: Create a SharePoint Web Part
To create a Web Part, add a Web Part item to any SharePoint project. To add controls to a Web Part, edit the Web Part code file.
You can also design a Web Part visually by using a designer. For more information, see How to: Create a SharePoint Web Part by Using a Designer.
To create a SharePoint Web Part
Create a new SharePoint project, or open an existing SharePoint project. For more information about SharePoint projects, see SharePoint Project and Project Item Templates.
In the Add New Item dialog box, in the Installed Templates pane, expand the SharePoint node, and then click 2010.
In the list of SharePoint templates, select Web Part, and then click Add.
In the Name box, type a name for the Web Part, and then click Add.
The Web Part item appears in Solution Explorer. For more information about the files included in a Web Part item, see Creating Web Parts for SharePoint.
In Solution Explorer, double-click the Web Part code file. For example, if the name of your Web Part is WebPart1, double-click WebPart1.vb (in Visual Basic) or WebPart1.cs (in C#).
The Web Part code file opens in the Code Editor.
Add controls to the CreateChildControls method of the Web Part code file. For an example, see Walkthrough: Creating a Web Part for SharePoint.
See Also
Tasks
How to: Create a SharePoint Web Part by Using a Designer
Walkthrough: Creating a Web Part for SharePoint
Walkthrough: Creating a Web Part for SharePoint by Using a Designer