private void openProgramLocation_Click(object sender, EventArgs e) { using (OpenFileDialog openFileDialog1 = new OpenFileDialog()) { if (exeLoc == "") { openFileDialog1.InitialDirectory = "c:\\"; } else { openFileDialog1.InitialDirectory = exeLoc; } openFileDialog1.Filter = "exe Files (*.exe)|*.exe|jar Files (*.jar)|*.jar|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 0; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { exeLoc = openFileDialog1.FileName; programText.Text = exeLoc; imgLoc = openFileDialog1.FileName; imgLocText.Text = imgLoc; if (nameTextBox.Text == "") { string exe = exeLoc.Split('\\')[exeLoc.Split('\\').Length - 1]; exe = Regex.Replace(exe, ".exe", ""); exe = Regex.Replace(exe, ".jar", ""); exe = Regex.Replace(exe, ".bat", ""); exe = UtilMethods.FirstLetterToUpperCaseOrConvertNullToEmptyString(exe); nameTextBox.Text = exe; } FileEnum fileEnum = UtilMethods.hasHighQualityIcon(UtilMethods.getFileName(exeLoc)); if (fileEnum != FileEnum.None) { DialogResult dialogResult = MessageBox.Show("Do you want to display a high quality icon for " + UtilMethods.getNameFromFileEnum(fileEnum) + " or not?", "High Quality Icon", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { imgLoc = "resources:" + UtilMethods.getImageNameFromFileEnum(fileEnum); imgLocText.Text = imgLoc; } else if (dialogResult == DialogResult.No) { //do something else } } } } }