none
Try Catch hide form1 show form2 RRS feed

  • Question

  • 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();
            }


    Sunday, December 1, 2019 11:42 AM

All replies

  • Hello,

    What is a "band" ?

    In regards to showing a custom message box or form in a try-catch, yes you can show one which it appears you are in the code.

    What is the current issue ?


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Sunday, December 1, 2019 12:28 PM
    Moderator
  • Hello,

    What is a "band" ?

    In regards to showing a custom message box or form in a try-catch, yes you can show one which it appears you are in the code.

    What is the current issue ?

    hide a form in this case the login form and just show the error form

    and sorry this english is from google translator


    Sunday, December 1, 2019 5:03 PM
  • If you want a login for MS-Access and allows say three attempts to login which is normal I can provide a solution. If so I can upload it to the web.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, December 2, 2019 12:19 PM
    Moderator