private void Form1_Shown(object sender, EventArgs e) { try { serverOperations = new SmoOperations(); var serverPath = serverOperations.SqlServerInstallPath(); if (System.IO.Directory.Exists(serverPath)) { lblInstalledPath.Text = $"SQL Server install path:{serverOperations.SqlServerInstallPath()}"; } } catch (Exception ex) { Controls.OfType <Button>().ToList().ForEach(b => b.Enabled = false); Dialogs.ExceptionDialog(ex); } }