private void Button3_Click(object sender, EventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog() { CheckFileExists = true, FileName = "", Title = "Open" }; DialogResult resl = ofd.ShowDialog(); if (resl == DialogResult.OK) { res robj = new res(); exec = ofd.FileName; loc = robj.getLocation(exec); type = robj.getExtension(exec); filename = robj.getFileName(exec); textBox1.Text = exec; } } catch (Exception ex) { msg.ShowError(ex.Message); } }