- VSTO 3.0 for Office 2007 Programming
- Vivek Thangaswamy
- 300字
- 2021-05-21 20:17:57
Creating our first example
In our first example, we will make you more comfortable, by explaining the Hello World example using Visual Studio 2008 and Microsoft Office InfoPath 2007.
Let's write a Hello World program as our first program, using VSTO 3.0 for Microsoft InfoPath 2007.
- Open Visual Studio 2008, and create a new InfoPath 2007 Form template project.
- Select New project. Under Office, select 2007 and then select InfoPath 2007 Form template, and name the project as per your requirements.
- Next, the Design Template dialog box appears. This is where you choose the template for your design requirement. In our example, we will select Blank and click on OK.
- The solution will be created with all of supporting files for our development of InfoPath solution. Let's write a Hello World message on a button click event for an InfoPath form. In the design task pane of the Visual Studio window, you can find the Controls button hyper linked. The following screenshot shows the InfoPath Design Task Pane inside Visual Studio.
- Next drag-and-drop a textbox to display the Hello World message and a button to write the
Click
event for, from InfoPath toolbox. The next image represents the InfoPath Toolbox Task Pane showing the InfoPath-supported controls. - Right-click on the button and select Button Properties from the shortcut menu. In the Button Properties window, click on the Edit Form Code button under the General tab. This will generate the
Click
event for the button. - Add the following code into the control's
Click
event:public void Click_Clicked(object sender, ClickedEventArgs e) { // Read the Textbox and write the "Hello World" XPathNavigator xNode = MainDataSource.CreateNavigator(). SelectSingleNode("/my:myFields/my:field1", NamespaceManager); // Set value to Textbox xNode.SetValue("Hello World"); }
Once you have added and executed the above code, you will get the following screenshot as the output.

推薦閱讀
- WordPress 2.7 Cookbook
- AutoCAD 2019中文版從入門到精通
- 24小時全速學會Photoshop 2021
- Web 2.0 Solutions with Oracle WebCenter 11g
- Premiere視頻編輯項目教程:Premiere Pro 2020(微課版)
- Flash Facebook Cookbook
- Drupal 6 Panels Cookbook
- Flash基礎與實戰教程
- Vue.js快速入門
- Word-Excel-PowerPoint 2010三合一辦公應用實戰從入門到精通(超值版)
- 科技繪圖/科研論文圖/論文配圖設計與創作自學手冊:科研動畫篇
- 這樣學Excel數據處理與分析更高效(視頻版)
- SilverStripe 2.4 Module Extension, Themes, and Widgets: Beginner's Guide
- Inkscape 0.48 Essentials for Web Designers
- AI賦能Rhino產品造型創意設計(視頻教學版)