On Your Own

Here’s an additional exercise that uses the Rss2v4Events.xsn template to demonstrate event-handling code reuse:

  1. Open the Default Values dialog box, and select the item field check box to make one item instance required.

  2. Open a preview window, and observe that the Pub Date text box is empty, because the OnAfterChange event doesn’t fire in this case.

  3. Choose Tools, Programming, On Load Event to add an OnLoad event-handling stub.

  4. Copy the Try...Catch...End Try block only from the item_OnAfterChange event handler to the OnLoad stub. The OnLoad event fires once when you open the form, so you don’t need the tests that precede the Try statement.

  5. The DocReturnEvent parameter doesn’t provide an OnLoad property, but it does have an XDocument property ...

Get Introducing Microsoft® Office InfoPath™ 2003 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.