TimeSpan from txt File
-
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
-
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
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