I believe this is because the MySqlConnection.Open is a blocking IO operation & it's waiting for the default timeout to elapse before reaching your catch block.
There is an OpenAsync method that is the asynchronous non-blocking version of this method, but unfortunately the MySql driver for C# hasn't actually implemented it, so it just falls back to the Open implementation. It states that in their docs too:
https://dev.mysql.com/doc/dev/connector-net/6.10/html/Methods_T_MySql_Data_MySqlClient_MySqlConnection.htm
The cancellation token can optionally be honored.The default implementation invokes the synchronous Open() call and returns a completed task
You can work around that by running your MySql block inside a new Task, which won't prevent your FormMeasurement_Load from finishing. You can do that like this:
_ = Task.Run(async () => {
...
});
The code inside that callback would be your existing code.
EDIT:
You'll also just need to replace this:
listBoxMeasurement.Items.Add(string.Format("Temperature: {0} Humidity: {1} Date: {2}", reader.GetString("temp"), reader.GetString("hum"), reader.GetString("datecreated")));
For this:
listBoxMeasurement.BeginInvoke(() => {
listBoxMeasurement.Items.Add(string.Format("Temperature: {0} Humidity: {1} Date: {2}", reader.GetString("temp"), reader.GetString("hum"), reader.GetString("datecreated")));
});
And this:
listBoxMeasurement.Enabled = false;
For this:
listBoxMeasurement.BeginInvoke(() => {
listBoxMeasurement.Enabled = false;
});