Potential problems

For resolving these potential problems, you need modify the converted C# codes.



1.  Potential 'DateTime' problem


DateSerial(year, month, day) new DateTime(year, month, day)

For the year argument, values between 0 and 99, inclusive, are interpreted as the years 1900¨C1999. e.g:
DateSerial(90, 1, 1)

In .NET, you have to use a complete four-digit year for the year argument. e.g:
new DateTime(1990, 1, 1)


2.  Potential 'IndexOf' problem


InStr([start, ]string1, string2[, compare]) string1.IndexOf(string2, [start-1, System.StringComparison])

InStr returns the position of the first occurrence of one string within another. If the string is not found, InStr returns 0.

The IndexOf method of System.String reports the index of the first occurrence of the specified String in this instance. If that string is not found, it returns -1.


3.  Potential 'LastIndexOf' problem


InStrRev(string1, string2[, start[, compare]]) string1.LastIndexOf(string2, [start-1, System.StringComparison])

InStrRev returns the position of an occurrence of one string within another, from the end of string. If the string is not found, InStrRev returns 0.

The LastIndexOf method of System.String reports the index position of the last occurrence of a specified String within this instance. If that string is not found, it returns -1.


4.  Potential 'Substring' problem


Left(string, length) string.Substring(0, length)
Mid(string, start[, length]) string.Substring(start - 1[, length])
Right(string, length) string.Substring(string.Length - length))

If the length argument is greater than the number of characters in string, the entire string is returned.

If the length arugmnet is greater than the number of characters in string, the ArgumentOutOfRangeException will be throwed.