locked
Send data from user input to XML

    Question

  • Hello,

    I have a windows 8 app that retrieves user information and then outputs that information to an xml file.

    I have one field in the app that is for my notes and this a free text field which is optional for the user to enter in information. That works so far but I also want to add in other fields from the app in the get and set fields.

    So for example:

    private string _userNotes;
    
    public string UserNotes
    {
       get{ return _userNotes; }
    
       set{ _userNotes = value; }
    }

    Instead of just passing the one values from the user input (_userNotes) I would want to have other values.

    For example:

    Created on _createTime. Created by _userLast; + _userFirst; User Info: _userEmail;

    I am able to concatenate the data using  return " " + " Sample Text" + "Test" + _userNotes; But when I try to add actual user input it fails and says object is null.

    Also instead of automatically displaying this in the textbox when the app runs I want the text to be hidden and only display in xml file.

    Any help on how to go about this would be greatly appreciated.

    Wednesday, July 30, 2014 4:01 AM

All replies

  • There's not enough information here to help you.  Do you have code snippet where the error occurs?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, July 30, 2014 1:10 PM
    Moderator
  • Hi Matt,

    I was able to get it to partially work by doing the following for example:

    private string _userNotes;
    
    public string UserNotes
    {
       string email = UserInformation.GetDisplayNameAsync(); //Get user email address
       get{ return "" + "Test Info" + "Test Test Test" + email + _userNotes; }
    
       set{ _userNotes = value; }
    }

    The problem I get is that whatever user information I get does not show up. Instead I get SystemObject.... error when it runs. Also everytime I run the app there seems to be a loop or something cause the information to repeat. So instead of one instance of the return string displaying in the textbox everytime I run another return string is added to the top of the previous and so on...

    Any ideas on how to fix those?

    Thursday, July 31, 2014 3:42 AM
  • Can you post your code to OneDrive?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, July 31, 2014 11:54 AM
    Moderator