Поделиться через


VSTO, Partial Classes, ENC (Edit and Continue) sample code

using System;

using System.Data;

using System.Drawing;

using System.Windows.Forms;

using Microsoft.VisualStudio.Tools.Applications.Runtime;

using Excel = Microsoft.Office.Interop.Excel;

using Office = Microsoft.Office.Core;

namespace ExcelWorkbook

{

    public partial class Sheet1

    {

        private void Sheet1_Startup(object sender, System.EventArgs e)

        {

        }

        private void Sheet1_Shutdown(object sender, System.EventArgs e)

        {

        }

        #region VSTO Designer generated code

        /// <summary>

        /// Required method for Designer support - do not modify

        /// the contents of this method with the code editor.

        /// </summary>

        private void InternalStartup()

        {

            this.button1.Click += new System.EventHandler(this.button1_Click);

            this.Shutdown += new System.EventHandler(this.Sheet1_Shutdown);

            this.Startup += new System.EventHandler(this.Sheet1_Startup);

        }

        #endregion

        private void button1_Click(object sender, EventArgs e)

        {

            Excel.Range range = null;

            range = this.Range["A1", "A3"];

            range.Value2 = "A Value";

            // ENC code added at debug time

            //range = this.Range["B1", "B3"];

            //range.Value2 = "B Value";

        }

    }

}

Comments

  • Anonymous
    April 24, 2006
    This was my first webcast, so please be patient through the beginning.&amp;nbsp; It gets much better there...