OK, unless I'm missing something obvious then it's simply that you've misinterpreted the second parameter.
it's the length of the string you want to extract, not the length of what you started with.
"TheBilly102030".Substring(3, 5) = "Billy"
"TheBilly102030".Substring(14 - 4, 14) = Error
Since you are asking it to grab 14 characters from a 14 character string starting at position 10, so it goes looking for characters between 10 and 24, most of which don't exist...
If what you want is the last three characters, or the last four, ot everything after the last "." then:
Dim filename as string = "TheBilly102030.doc"
Dim filetype as string = filename.Substring(filename.length - 3, 3) = "doc"
The variable version is done simply by grabbing the position of the last "." and substituting that for the literal number used above.
MSDN[
^]
Mike