INIFile: GetTimeSpan


Returns a TimeSpan value from the specified key in the specified section of an INI file.

 Public Function GetTimeSpan(
	  ByVal Section As String,
	  ByVal Key As String,
	  Optional ByVal Default As TimeSpan ) As TimeSpan


[ByVal] String. The section within the INI file to search for the key.
[ByVal] String. The key in the section of an INI file to retrieve the value of.
[ByVal] Optional. TimeSpan. The default value to return if the key is not found in the section, or the value could not be converted to a TimeSpan.

Return Values

TimeSpan - 


An INI file contains all values as Strings. The value is converted back into a TimeSpan by first testing if the string is a date and taking the Time portion, otherwise, the normal TimeSpan.Parse method is used. This expects the string to be in the TimeSpan format. If an error happens, then the default is returned.

Passing in Nothing for the default will return TimeSpan.Zero for the default.

See Also

Project VBCorLib Overview Class INIFile Overview INIFile Properties INIFile Methods GetString GetValues