Does not exist in the current context - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Does not exist in the current context

Last post 06-18-2009 03:31 AM by dracosha. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-18-2009 02:43 AM

    Does not exist in the current context

    c# & form for Formservice

     

    using Microsoft.Office.InfoPath;
    using System;
    using System.Windows.Forms;
    using System.Xml;
    using System.Xml.XPath;
    using System.Xml.Linq;
    using mshtml;

    namespace temp2
    {
        public partial class FormCode
        {
            public void InternalStartup()
            {
                EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);
            }

            public void FormEvents_Loading(object sender, LoadingEventArgs e)

            {
                thisXDocument.DOM.selectSingleNode("/Sign/DocGUID") = Guid.NewGuid().ToString();
            }
        }
    }

     

    result - error:
    The name 'thisXDocument' does not exist in the current context

    Please help with problem...

  • 06-18-2009 02:54 AM In reply to

    Re: Does not exist in the current context

     It looks like your form is set up to use the the 2007 InfoPath object model, which requires different objects to access the data source than what you have there.

    Please try

                MainDataSource.CreateNavigator().SelectSingleNode("/Sign/DocGUID").SetValue(Guid.NewGuid().ToString());

    But that XPath looks a little fishy to me.  Please try:

                MainDataSource.CreateNavigator().SelectSingleNode("/my:Sign/my:DocGUID", NamespaceManager).SetValue(Guid.NewGuid().ToString());

    Or

                MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Sign/my:DocGUID", NamespaceManager).SetValue(Guid.NewGuid().ToString());
     

    If the first one doesn't work.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 06-18-2009 03:31 AM In reply to

    Re: Does not exist in the current context

    wah... first one working... many thanks for you!

    I think i'm really use 2007 Infopath object model...

    Thank you!

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.