Upload form template error on verification - InfoPath Dev
in

InfoPath Dev

Upload form template error on verification

Last post 06-15-2007 12:09 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-20-2007 02:39 AM

    Upload form template error on verification

    Hello, I am quite new in infopath development and development in general. I have a simple form template with code behind (C#). It works fine in preview.

    When I do a verify before upload to Sharepoint I got a few errors :

    here is a part of my code :

    using Microsoft.Office.InfoPath;
    using System;
    using System.Xml;
    using System.Xml.XPath;
    using System.Data.SqlClient;

    namespace GetUserInformation
    {
        public partial class FormCode
        {
            public string CurrentUserName;
            public string CurrentDomainName
    ;
     
            // Member variables are not supported in browser-enabled forms.
            // Instead, write and read these values from the FormState
            // dictionary using code such as the following:
            //
            // private object _memberVariable
            // {
            //     get
            //     {
            //         return FormState["_memberVariable"];
            //     }
            //     set
            //     {
            //         FormState["_memberVariable"] = value;
            //     }
            // }

    ...

    I then get the domain and current user name in the declared variables. The commented code says what the error will be and how to cope with it,  but I don't know how to handle this.

    Can anybody help me out please ?

    OTHER Question : by using Formstate, will my form still work in Infopath ???

    Thanks 

     

  • 06-15-2007 12:09 PM In reply to

    Re: Upload form template error on verification

    So, you'll want to change you code to be like this:

    private object CurrentUserName
    {
        get
        {
     return FormState["CurrentUserName"];
        }
        set
        {
            FormState["CurrentUserName"] = value;
        }
    }

    private object CurrentDomainName
    {
        get
        {
     return FormState["CurrentDomainName"];
        }
        set
        {
            FormState["CurrentDomainName"] = value;
        }
    }

     Judging from the error message, I'd say, yes, it will work if you change it to be this. Good luck!

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.