Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SharePoint > SharePoint 2010 > BOOK: Beginning SharePoint 2010 Development
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning SharePoint 2010 Development
This is the forum to discuss the Wrox book Beginning SharePoint 2010 Development by Steve Fox; ISBN: 978-0-470-58463-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning SharePoint 2010 Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 12th, 2011, 10:15 AM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 2 Create a custom webpart programmatically

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace MyFirstWebPart.MyFirstWebPart
    public class MyFirstWebPart : WebPart
        Label lblUserEntry = new Label();
        TextBox txtbxUserEntry = new TextBox();
        Label lblFinalCost = new Label();
        TextBox txtbxFinalCost = new TextBox();
        Button btnCalcTax = new Button();
        double totalTax = 0.00;
        double prodTax = 0.11;
        public MyFirstWebPart()
        { }
        protected override void CreateChildControls()
            lblUserEntry.Text = "Cost of Widget";
            lblFinalCost.Text = "Fianl Cost";
            btnCalcTax.Text = "Calc.";
            txtbxUserEntry.Text = "59.30";
            this.Controls.Add(new LiteralControl("<p>"));
            this.Controls.Add(new LiteralControl("<p>"));
            btnCalcTax.Click+=new EventHandler(btnCalcTax_Click);

        void btnCalcTax_Click(object sender, EventArgs e)
            double prodCost = Convert.ToDouble(txtbxUserEntry.Text);
            txtbxFinalCost.Text = totalTax.ToString();

        protected override void RenderContents(HtmlTextWriter writer)

shows following error when I press F5
cannot start service SPUserCodeV4
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 17-WebPart error Berdia BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 0 May 24th, 2010 08:15 AM
Create SQL Server users programmatically? Dmitriy Pro VB.NET 2002/2003 4 October 29th, 2008 03:14 PM
Create SQL Server user programmatically? Dmitriy Pro VB Databases 1 March 8th, 2006 10:02 AM
Create SQL Server database user programmatically? Dmitriy VB.NET 3 January 3rd, 2006 12:30 PM
Create SQL Server database user programmatically? Dmitriy Pro VB 6 0 December 8th, 2005 02:04 PM

All times are GMT -4. The time now is 04:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.