View Single Post
  #1 (permalink)  
Old March 24th, 2011, 04:27 PM
AlexGrab AlexGrab is offline
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.
Reply With Quote