To work with Snadbpxed solutions, first thing you need to start Microsoft SharePoint Foundation Sandboxed Code Service into Central Administration..
Step to Start Sandboxed service:
1- Navigate to System Settings –> Clickon Manage Services on Server and start the “Microsoft SharePoint Foundation Sandboxed Code Service” service.
Create a Sandboxed solution:-
1- Create a SharePoint Project in Visual Studio > In SharePoint Customization Wizard: From What is the trust level for this SharePoint solution? > select Deploy as a sandboxed solution.
2- Add New Item > Select Web Part from SharePoint 2010 Templates
3- Add below lines in WebPart.cs file at CreateChildControls event
Label _label1 = new Label();
_label1.Text = "Hi this is from sandboxed solution......";
4- In case you missed to select option Deploy as Sandboxed solution at the time of Project Creation then you can change it later > Select Project in Solution Explorer> Open Properties Window > In Sanboxed Solution select True
5- Now create wsp file of this solution by click on Package on Project
Upload Sandboxed Solution:
1-Go to the Site Actions > Site Settings > Galleries > Solutions > Click on Upload Solution
Activate Sandboxed Solution:
see here activated sandboxed solution...
Finally add .wsp file to SharePoint web part page...