Search code examples
c#infopath

How to load items into InfoPath form asynchronously?


In my Infopath 2013 form I have a drop-down list, which is populated from code. Data is downloaded from WCF service. The problem is, that service is so slow, loading of form takes too long (over 30 seconds). My code is currently in FormEvents_Loading event. I was wondering, if there is any way to load data asynchronously after the form is loaded and shown.

First try was to simply create a Task, but it seems to be not available in Infopath.

So, the problem is: what can I do, except from creating a "click to load" button, to improve loading time of form?


Solution

  • As far as I know, You cannot do this. I have tried doing this myself, also to address long load times.

    Any data source that is providing the items for a UI item (a drop-down, in your example) must be loaded in the FormEvents_Loading method.

    This was the case for InfoPath 2007, and I have no reason to suspect it has changed since, though I have not checked.