Microsoft Office Tutorials and References
In Depth Information
Creating an InfoPath add-in project using Visual Studio 2008
10. Add Labels, Textbox, and Button controls to the windows form to create
the user interface for your number-to-word convertor. Number-to-word
converter is an example that has been included in this section to explain
the add-in. It converts the numbers (stored as digits) into words; this
functionality is not available in the InfoPath by default. The number-to-word
conversion code has been written inside the NumericConvertor.cs , which is
called for execution in the Windows forms added to your project. It appears
as shown in the following image:
11. Here's the code to append the custom button for our add-in to Microsoft
InfoPath 2007.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
// Code to append the custom button we created to the standard
toolbar
if (this.Application.ActiveWindow != null)
{
Office.CommandBars AddInCommandBars = (Office.
CommandBars)this.Application.ActiveWindow.CommandBars;
Office.CommandBar AddInStandardBar =
AddInCommandBars["Standard"];
if (AddInStandardBar != null)
{
Office.CommandBarButton AddInConverterButton = (Office.
CommandBarButton)AddInStandardBar.Controls.Add(
Office.MsoControlType.msoControlButton, Type.Missing,
Type.Missing, Type.Missing, true);
// Button properties
AddInConverterButton.Caption = "Convert Number";
AddInConverterButton.Visible = true;
AddInConverterButton.Enabled = true;
 
Search JabSto ::




Custom Search