The reason for this is because the Environment.CurrentDirectory property changes depending on how your app gets started up. In fact, any assembly can change this property at any time while your app is running.
For this reason you shouldn't rely on the CurrentDirectory property (and as a result should rely on specifying just the file name when opening files). Instead specifiy the full file path by getting the location of the exe.
Fortujnately, it's real easy to do this:
Code:
var appDirectory = Path.GetDirectoryName( AppDomain.CurrentDomain.SetupInformation.ConfigurationFile );
using( var sr = StreamReader( Path.Combine( appDirectory, "Table.tbl" ) ) )
{
// and so on
}
Tip: The 'using' syntax above will automatically close and dispose the streamreader object. This simplifies the code and ensures that the object gets properly cleaned up. Generally you can use a using block on any object where you normally call Dispose( ).