Try Catch hide form1 show form2

  • Thread starter Thread starter joaofilipesousainacio
  • Start date Start date
J

joaofilipesousainacio

Guest
Hello everyone.
I'm new to these bands would like to know if I can with a custom "messageBox form" show in a try catch?


private void Form1_Load(object sender, EventArgs e)
{

try
{
string MySqlConnectionString = "datasource=127.0.0.1;port=3306;username=root;password=;database=teste_com_c#";
MySqlConnection conn = new MySqlConnection(MySqlConnectionString);
conn.Open();
if (conn.State == ConnectionState.Open)
{
Trace.WriteLine("Hehe Boay");
}

}catch(Exception)
{
show_message();
}

}
private void show_message()
{
custom_msg_failed_conn cmfc = new custom_msg_failed_conn();
cmfc.Show();
}

Continue reading...
 
Back
Top