I want to have my program open word and then a specific document, really just using word as an example. This could be useful in other situations, but I'd like to know how to do so with arguments. I have a bit of code to open a program, and some code to display an error message if the file path does not exist here:
private void StartProcess(string path)
{
ProcessStartInfo StartInformation = new ProcessStartInfo();
StartInformation.FileName = path;
Process process = Process.Start(StartInformation);
process.EnableRaisingEvents = true;
}
private void ClickFunc(object sender, RoutedEventArgs e)
{
if (File.Exists(ProgramPath))
{
StartProcess(ProgramPath);
}
else
{
MessageBox.Show("Specified path does not exist, please try again.", "Bad File Path Error", MessageBoxButton.OK);
}
}
And I was wondering how I could add arguments to it. Thanks!