I\'ve got a button on a form that starts a process which, after x (varies) seconds, changes some data in a database table Y. The call InitializeGridView() then refreshes the DGV
You can call p.WaitForExit() on the process, but don't do that on the main thread (ie in a buttonClick);
You'll want something like:
//untested
private void btRunProcessAndRefresh_Click(object sender, EventArgs e)
{
var p = Process.Start(@"\\fileserve\department$\ReportScheduler_v3.exe", "12");
p.Exited += ProcessExited;
p.EnableRaisingEvents = true;
//InitializeGridView();
}
void ProcessExited(object sender, EventArgs e)
{
InitializeGridView();
}