Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 24th, 2011, 04:27 PM
Authorized User
 
Join Date: Dec 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH5 Web Server Lists P. 184 Exceptions

Hello

So When I get to the end of this example on p.184, I get 2 exceptions in the Addin.cs file. I get the exception encased in ***'s.

Code:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            ***ctp = this.CustomTaskPanes.Add(ctrl, ctrlTitle);***
            ctp.Visible = true;
            ctp.DockPosition = Microsoft.Office.Core.MsoCTPDockPosition.msoCTPDockPositionRight;
        }
Exception 1:
The best overloaded method match for 'Microsoft.Office.Tools.CustomTaskPaneCollection.A dd(System.Windows.Forms.UserControl, string)' has some invalid arguments

Exception 2:
Argument 1: cannot convert from 'ProductsList.XAMLHost' to 'System.Windows.Forms.UserControl'

____________________________________________

ALSO, I'm having trouble with The UserControl1.xaml.cs file. A BUNCH of methods and components "Do not exist in the current context" as soon as I add the XAMLHost.xaml file to the project. Where before I added it to the project I wasn't having any issues.

These include the following:
Code:
        public UserControl1()
        {
            InitializeComponent();
        }
The name "InitializeComponent does not exist in the current context

Code:
lstBxProducts.Items.Add(tempProduct.productTitle);
and
Code:
        private void lstBxProducts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string strSelectedProd = lstBxProducts.SelectedItem.ToString();
The name 'lstBxProducts does not exist in the current context

Code:
            foreach (var d in products)
            {
                txtbxSku.Text = d.productSKU;
                txtbxPrice.Text = d.productPrice;
            }
The name 'txtbxSku' does not exist in the current context.
The name 'txtbxPrice' does not exist in the current context.
  #2 (permalink)  
Old March 24th, 2011, 05:22 PM
Authorized User
 
Join Date: Dec 2010
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, well it looks like this has something to do with the project needing to use using System.Xaml and also it being in .NET 3.5 where it needs to be in .NET 4.0 for using System.Xaml to work. Since the author is stating that it cannot be in 4.0, I'm stumped as to what to do here. As far as I can tell, this example can't be completed.

If there are any suggestions that I'm missing, please let me know. I'm moving to the next example.
  #3 (permalink)  
Old March 2nd, 2013, 10:06 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can Not complete exercise

I concurr, the tartget framework is supposed to be 3.5 but the using.system.Xaml requires 4.0. Are there any suggestions???


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch5 List Web Servcie cchiang12 BOOK: Beginning SharePoint 2010 Development 0 November 12th, 2010 01:31 PM
C# handling SQL Server exceptions booksnore2 General .NET 3 September 16th, 2006 09:40 AM
Web Exceptions dotnetprogrammer VS.NET 2002/2003 0 November 3rd, 2004 03:39 AM
CH5 p 184 wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 November 17th, 2003 04:41 PM





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