Urgent Help needed for coding a textbox to have data in it. - InfoPath Dev
in

InfoPath Dev

Urgent Help needed for coding a textbox to have data in it.

Last post 02-06-2009 05:48 AM by Ejuozaitis. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-05-2009 12:14 PM

    Urgent Help needed for coding a textbox to have data in it.

    I am looking for help and fast.  I have been able to get a auto number to be created from a different file and post back an updated number but I can not write the data to the textbox.  Could someone please help me?  I am using Visual Studio 2008 to create the form (InfoPath 2007) and would appreciate any help to resolve the issue.  Code segment is below.

     

    public void FormEvents_Loading(object sender, LoadingEventArgs e)

    {

    string fileContents;

    int myNumber;

    string myline;using (StreamReader sr = new StreamReader(@"G:\Service Dept Database\Doc\Test1.txt"))

    {

    fileContents = sr.ReadLine();

    XPathExpression.Compile(fileContents);

    //MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:RecallNo").Value("09");

    }

    using (StreamWriter sw = new StreamWriter(@"G:\Service Dept Database\Doc\Test1.txt"))

    {

    myNumber =
    Convert.ToInt16(fileContents) + 1;myline = Convert.ToString(myNumber);

    sw.WriteLine(myline);

    }

    }

  • 02-05-2009 07:07 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Urgent Help needed for coding a textbox to have data in it.

    Hello,

    Can you try below code,

    XPathNavigator recallNode = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:RecallNo");

    recallNode.setValue("09");

  • 02-06-2009 05:48 AM In reply to

    Re: Urgent Help needed for coding a textbox to have data in it.

    Shiva, thank you for the code which I would have to try to see if it would work as well.  It was just so happens that I did find some code that gave me the result that I wanted, which I have attached below.  Now I just have to see if the form will act as a webpage or not, which if it does that would just make my day.  I still have to change the file name when someone submits the information to the Document Library any ideas on setting the filename based on the RecallNo field?

    XPathNavigator myNav = this.MainDataSource.CreateNavigator();

    myNav.SelectSingleNode("/my:myFields/my:RecallNo", this.NamespaceManager).SetValue(myDate.ToString("yy") + "-" + fileContents);

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