 <p>Declare the variable outside of both the functions so it can be accessed by either function.</p> <pre><code>private string getFileName = ''; protected override void SomeFunction(){ switch (ofd.ShowDialog()) { case DialogResult.OK: getFileName = Path.GetFullPath(ofd.FileName); labelStatus.Text += getFileName; break; } } private void button1_Click(object sender, EventArgs e) { try { Process.Start(getFileName); } catch { //... } } </code></pre> <p>I suggest you search YouTube for c#.net variable scope to better understand when an where a variable can be accessed :)</p>