Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. TimeSpan from txt File

TimeSpan from txt File

Scheduled Pinned Locked Moved Visual Basic
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ineedhelp
    wrote on last edited by
    #1

    I need to store a TimeSpan value on the harddisk when the application exits, and then when it loads, read the value and convert it back to TimeSpan data type. Having tryed several methods I'm stumped. I was using StreamWriter and writing it as a single string and then tryed it as three seperate strings for hours, minutes, seconds. Then reading each string seperately, converting to Integer and setting the TimeSpan values from the Integers. no luck though. Thanx in advance

    D 1 Reply Last reply
    0
    • I ineedhelp

      I need to store a TimeSpan value on the harddisk when the application exits, and then when it loads, read the value and convert it back to TimeSpan data type. Having tryed several methods I'm stumped. I was using StreamWriter and writing it as a single string and then tryed it as three seperate strings for hours, minutes, seconds. Then reading each string seperately, converting to Integer and setting the TimeSpan values from the Integers. no luck though. Thanx in advance

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      If you write the value as a String to the file, you can read it back an use something like this to get it back into a TimeSpan object:

      Dim newTS As New TimeSpan
      Dim fileValue As String
      
      ' read the TimeSpan from the file and put it in fileValue.
      newTS = TimeSpan.Parse( fileValue )
      

      RageInTheMachine9532

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups