Creating the Note Naming Convention - Day 4 - Part 4

Sign in to queue

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

Download

Download this episode

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.

Add Your 2 Cents