p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning SharePoint 2010 Development (http://p2p.wrox.com/forumdisplay.php?f=583)
-   -   CH5 Web Server Lists P. 184 Exceptions (http://p2p.wrox.com/showthread.php?t=83049)

AlexGrab March 24th, 2011 04:27 PM

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.

AlexGrab March 24th, 2011 05:22 PM

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.

smillerii March 2nd, 2013 10:06 AM

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???


All times are GMT -4. The time now is 09:00 AM.

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