Scenario/Problem: | You need to create a changed event method on a control. |
Solution: | Select the control and click the Changed Event button on the Developer ribbon bar. |
Creating any methods produces code-behind in your
form. For the overall scenario of this chapter, you need to generate a
changed event method and place the code within that method.
For the example, select the drop-down list control
and then click the Changed Event button on the Developer ribbon bar to
generate the code-behind method, as shown in Figure 1.
Note
To use code-behind, you need Microsoft Office Visual
Studio Tools for Applications (VSTA) installed. If you do not have this
installed, you may change the Microsoft InfoPath 2010 program in the
Control Panel and select the VSTA option under Microsoft Office,
Microsoft InfoPath, .NET Programmability Support.
The code is generated with an event handler declaration and a blank changed method, as shown in Figure 2.