Day 3 Homework Solution

Download this episode

Download Video

Description

Got stuck with the homework assignment?  No worries, simply watch enough of this solution video to get un-stuck, OR compare your solution with Bob's version. IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You'll only learn through practice, frustration, and exploration.

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
      spier

      You mentioned in your instructions to catch / trap for the user clicking save, delete, edit button at the wrong time and didn't cover it is in the solution. I just went ahead and set the isEnabled for each of the buttons to prevent the user form clicking the wrong button in the first place...

      I did this with a method setIconButtons(bool edit, bool save, bool delete) and then in each icon button click I told it which icon buttons to turn on / off…

      Great lesson!

      Thanks,

      Scott

       

       

    • User profile image
      Marco Forte

      Hey theres actually an enumeration for Filemode called "Truncate" that will Completely wipe all data in the file without creating another.
       
      Love the Series Marco

    • User profile image
      Mintydog

      I made a mess of mine. I did everything up to the save point. When trying to save it I was using the technique from the Tombstoning lesson, it didnt work Sad

    • User profile image
      Mintydog

      Ahh, I've just finished the full thing and I did the delete function different, with fewer lines of code.

      I called the isolated storage and deleted the file, then set the textbox to "".

      3 lines of code is all it took Smiley

    • User profile image
      Jaguma

      @Mintydog: Same Wink

      Oh yeah, GREAT TUTORIALS BOB Smiley

    • User profile image
      Jaguma

      Also, to delete the file, couldn't you have just used - 

      private void delete_click(object sender, EventArgs e)
              {
                  string fileName = "My_Note.txt";
                  IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
                  storage.DeleteFile(fileName);
                  outputBox.Text = "";
                  inputBox.Text = "";
              } // Delete

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.