Put a windows form on a SharePoint web site
Open Visual Studio 2008, create a new project, chose the template “Windows Forms Control Library”.
Add a button and a textBox on the userControl. Add some text into the textBox when the button is clicked. Build the project. We will copy later the dll file that has been generated.
Open Visual Studio 2008, create a new project, choose SharePoint for project type and WebPart for Template. Drive your class from Microsoft.SharePoint.WebPartPages.WebPart. Override the RenderWebPart method in order to display the object that is your dll.
Right click on the project, properties, in the Debug tag, write the URL address of your web application for the section Start Section, Start Browser with URL.
Deploy the project.
When we develop a custom web part, we place its resources under the _wpresources web site, into a folder named <WebPartAssemblyName>/<WebPartAssemblyVersion>__<PublicKeyToken>. You can create there a subfolder (named "bin" por example) to place the win control assembly. This folder must have execute permissions set to Script Only (not Script and Executables as is the default under a SharePoint site). The picture bellow shows the resulting structure when placing the win form control assembly in a web part called MyCustomWebPart that is part of the MyCustomWebParts assembly:
Add the created web part with the win form object on your SharePoint web application.
Comments
Anonymous
May 29, 2009
PingBack from http://asp-net-hosting.simplynetdev.com/put-a-windows-form-on-a-sharepoint-web-site/Anonymous
February 15, 2016
Hi, I tried this one, and it didn't work for me. I'm not sure if it can see my .dll file. Can you please help me?