Obj Reference not set to an instance - InfoPath Dev
in

InfoPath Dev

Obj Reference not set to an instance

Last post 07-18-2006 10:13 AM by Matt Faus. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-16-2006 03:13 PM

    • garym
    • Top 500 Contributor
    • Joined on 07-12-2006
    • USA
    • Posts 29

    Obj Reference not set to an instance

    I have seen the following error in a number of messages, but they don't seem to pertain to my situation.

    Object reference not set to an instance of an object.

    Here is part of my code...

    ' The following function handler is created by Microsoft Office InfoPath. Do not
    ' modify the type or number of arguments.
    <InfoPathEventHandler(MatchPath:="/dfs:myFields/dfs:dataFields/d:tblTimeSheet/@Date", EventType:=InfoPathEventType.OnAfterChange)> _
    Public Sub tblTimeSheet_Date_attr_OnAfterChange(ByVal e As DataDOMEvent)
    ' Write code here to restore the global state.


    If (e.IsUndoRedo) Then
    ' An undo or redo operation has occurred and the DOM is read-only.
    Return
    End If

    Dim ppCount As Integer

    Dim ppCurrentDate As DateTime
    Dim ppCurrentPeriod As DateTime

    Dim ppResult As Boolean

    Dim ppDate As DateTime = thisXDocument.DOM.selectSingleNode("//my:Date").text

    When I try to reference the text field I receive the error.

    Also, what book do you recommend on coding Infopath with VB.Net?

    Thanks for the help.

  • 07-16-2006 06:31 PM In reply to

    • garym
    • Top 500 Contributor
    • Joined on 07-12-2006
    • USA
    • Posts 29

    Re: Obj Reference not set to an instance

    I resolved this problem by using the following statement...

    e.Source.nodeValue.ToString()

    instead of...

    thisXDocument.DOM.selectSingleNode("//my:Date").text


    Thanks,
  • 07-18-2006 10:13 AM In reply to

    Re: Obj Reference not set to an instance

    Glad you could figure it out so quickly, Gary!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.