Setting Focus on Field - InfoPath Dev
in

InfoPath Dev

Setting Focus on Field

Last post 02-21-2007 06:33 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-21-2007 12:23 PM

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57

    Setting Focus on Field

    Hello,

    I have been searching the forums on how to set the focus to a field. I used the code provided in some of the responses but I am still having an issue when attempting to set the focus to a check box: I run this code (written in VB) in an afterUpdate event:

    Dim objectField1 = e.Xdocument.DOM.selectsingleNode("/dfs:myFields/dfs:datafields/d:AForm49B/@Gender")

    e.xDocument.View.SelectText(objField1, Type.Missing)



    and I receive this error:

    The specified values for the View.SelectText call are not valid.
    at Microsoft.Office.Interop.InfoPath.SemiTrust.View.SelectText(IXMLDOMNode pxnField, Object varViewContext)
    at Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.SelectText(IXMLDOMNode pxnField, Object varViewContext)
    at DHS49B.DHS49B.CTRL7_OnClick(DocActionEvent e) in E:\goldmine\GMForms\DHS49Forms\DHS49Forms\DHS49B\DHS49B\FormCode.vb:line 752
    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

    Can anyone tell me what I am doing wrong?

    Thanks!

    Bill
    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 02-21-2007 02:20 PM In reply to

    Was the field visible, and not read-only before the afterUpdate event?
  • 02-21-2007 05:06 PM In reply to

    • Bill
    • Top 200 Contributor
      Male
    • Joined on 09-26-2006
    • USA
    • Posts 57
    Yes:

    It is a live field on the form. Do you have any ideas?

    Bill
    William L Fringer
    Database Administrator/Systems Integration Specialists

    L & S Associates, Inc.
    Michigan State University Corporate Research Park

    1-800-766-6185, ext 2076
  • 02-21-2007 06:33 PM In reply to

    What type of control is bound to the field? Never mind -- I see above you said it was a check box. This is the problem. Only certain controls can be selected. A check box is unfortunately not one of them.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.