I have this code. I am trying to retrieve just the text \"first program\". Considering that i know the index say 25 and total length of string is 35.
string
The second parameter to Substring is how long you want the substring to be, not the end point of the substring. 25 + 35 is outside the range of the original string, so it throws an exception.
Substring
25 + 35