I have done some research and found the following code can be used to set focus to a control that is bound to a data source.
Private Sub SetFieldFocus(ByVal xpath As String)
Dim textNode As XPathNavigator = CreateNavigator().SelectSingleNode(xpath, NamespaceManager)
CurrentView.SelectText(textNode)
End Sub
I tested it and it works; however it will not work if I set the form to be “Browser Compatibility”.
The message I get is: 'SelectText' is not a member of 'Microsoft.Office.InfoPath.View'
I am coding in VB and using InfoPath 2007 and SharePoint MOSS 2007.
Dose anyone know how I can set focus to a control that is bound to a data source in a browser compatible form?
Thank you,
Steve