Search code examples
.netinfopathinfopath2010

Infopath 2010 setting focus on a field in .NET Code?


I'm building a desktop (thick) Infopath 2010 form with code-behinds that need to set form focus on certain fields so that they are on the field in question for easier entry. Is there a way to do this in .NET? Offhand I can't seem to find a way.


Solution

  • Use the SelectText method of the View class

    Link for script http://msdn.microsoft.com/en-us/library/bb251012(v=office.12).aspx

    Link for managed code http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.view.selecttext.aspx