private void Browse_Click(object sender, EventArgs e) { try { Receivers.Filter = "csv files (*.csv)|*.csv"; DialogResult result = Receivers.ShowDialog(); if (result == DialogResult.OK) { ReceiversPath.Text = Receivers.FileName; } } catch (Exception ex) { string message = ex.Message; string caption = "Error"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons, MessageBoxIcon.Error); } }