Code:
FileStream obj = new FileStream(System.Convert.ToString(row.Cells["Lec_media"].Value), FileMode.Open, FileAccess.Read, FileShare.Read);
if (Startdate2 == JCM_NOW2)
{
if (checkBox1.Checked == true)
{
try
{
obj = null;
System.Diagnostics.Process.Start(System.Convert.ToString(row.Cells["Lec_media"].Value));
}
finally
{
if (obj != null)
obj.Close();
}
}
}
if (Enddate2 == JCM_NOW2)
{
if (obj != null) ((IDisposable)obj).Dispose();
obj.Close();
// this code does not close the file which opened above .. why?
}
Comment