Creating the Note Naming Convention - Day 4 - Part 4

Download this episode

Download Video

Description

In this video, Bob discusses the strategy of using the file name as a means of storing the date and time the note was created, along with the location of the note’s composition. This requires quite a bit of familiarity with String and DateTime classes and their methods for formatting and parsing through data.

Download the source code in c#

Download the source code in VB.Net

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      jamesoneill

      Writing the code to parse the date / time from the file name at 15 mins was a bit painful, much easier with

      DateTime dateCreated = DateTime.ParseExact(file.Substring(0,16), "yyyy_MM_dd_HH_mm",System.Globalization.CultureInfo.InvariantCulture);

       

    • User profile image
      ELMDEV

      Hi,

      Great video!  One problem tho 

      string[] fileList = appStorage.GetFileNames();

      creates collection starting at [0].  Running debug/emulator, I cannot get location to display on Page_Load in [0].  So I have to run thru the loop once, then hit the Add_Button(+) on Mainpage then continue loop for location to display in [1]. Any reason [0] is reserved for anything?  Anybody else have same prob?

      Thanks,

      E. 

    • User profile image
      ELMDEV

      Got it worked out.@ELMDEV:

    • User profile image
      Mintydog

      I hate to write

      string

       

      location = file.Substring(19);

       It had to have a 19 instead of a 20, with 20 it cut off the R in Redmond, I dont know why cos i had everything else correct, and it picked up the date and time just right.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.