davinceleecode
davinceleecode

Reputation: 807

How to open (.tif) file using System.Diagnostics

I have problem during opening a (.tif) file it throws an exeption "The system cannot find the file specified". Below is my code on how to open (.tif) file:

try
{
    ProcessStartInfo p = new ProcessStartInfo();
    p.FileName = "MSPVIEW.exe";
    p.Arguments = @"C:\New folder\sample.TIF";
    p.UseShellExecute = false;
    p.ErrorDialog = false;
    p.RedirectStandardOutput = true;
    p.WindowStyle = ProcessWindowStyle.Maximized;
    Process.Start(p);
}
catch (Exception ex)
{

    MessageBox.Show(ex.Message);
}

But when I'm going to open a (.txt) file there's no problem with it. Below is my code on how to open (.txt) file:

try
{

    ProcessStartInfo p = new ProcessStartInfo();
    p.FileName = "notepad.exe";
    p.Arguments = @"C:\New folder\NewTextFile.txt";
    p.UseShellExecute = false;
    p.ErrorDialog = false;
    p.RedirectStandardOutput = true;
    p.WindowStyle = ProcessWindowStyle.Maximized;
    Process.Start(p);
}
catch (Exception ex)
{

    MessageBox.Show(ex.Message);
}

Is there anybody have the same issue of opening of (.TIF) file? Or provide some solution on how to fix this?

Upvotes: 0

Views: 358

Answers (1)

jtower
jtower

Reputation: 56

It sounds like either the path to mspview.exe or sample.TIF isn't valid. Can you specify the full path to mspview.exe and open Windows Explorer to verify the path to sample.TIF?

Upvotes: 1

Related Questions