Um...did you mean
If M.Success = True AndAlso s.Contains(File_Name.Value) = True Then
Given that M doesn't change at all inside either of your loops.
If that doesn't solve it, you need to use the debugger to step through each line, working out what you expect to happen before each statement executes and comparing that against the actual results. Remember that you can look at the content of each variable as you go. When you find something that isn't right...then you can look more closely.
We can't do that for you - we don't have access to your code or your data.