In my code:
private void cbbMaoDeObra_TextChanged(object sender, EventArgs e)
{
try
{
int resultado = Convert.ToInt32(cbbMaoDeObra.SelectedValue);
if (resultado == 0)
{
btnConfirmar.Enabled = false;
}
else
{
ViewStateWorkLogger = ViewStateWorkLogger.AbleToConfirm;
}
MaoDeObra = resultado;
}
catch (Exception)
{
return;
}
}
I have a try-catch to deal with some errors. My dynamic program, when started, will have a variable of type string
in cbbMaoDeObra and when it starts, this string is just 'letters' and can't be parsed. SelectedValue. This is because just after some events I initialize it and read from de Database. Then, without workarounds like I did up, like using return or leave the field empty, how can I deal with these errors?
Is try { statement } catch { empty }
recommended to be used?