I have this method, which opens an excel file, what I try is that when the route is not correct I can not continue the program until the connection is correct.
private void Conectar()
{
try
{
sheet = excel.Workbooks.Open(tbxRuta.Text);
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Fallo al abrir el archivo...", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
What would be convenient to carry out the program correctly?