I need to make the click event of a button on a form open another modal form. While the other form is loaded, I need to display the user a message on a StatusLabel from a StatusStrip. (a msg of type ... Wait for the configuration to be loaded ...)
The behavior I noticed is that the message displayed to the user always loads after the modal form is opened, operated by the user, and then closed. The secure click event to display the message to the user until the modal of the other form is closed.
I tried to use a BackgroundWorker inside the click event, both to update the UI with a message, and to try to open the other modal form, but it did not work.
private void btnEdit_Click(object sender, EventArgs e)
{
modelStatusLabel.BackColor = Color.FromArgb(192, 255, 192);
modelStatusLabel.ForeColor = Color.Green;
modelStatusLabel.Text = "Por favor aguarde a configuração ser carregada...";
FormAddModel frmAddModelo = new FormAddModel(this, nameConfigFile);
frmAddModelo.ShowDialog(this);
}
How can I do this?
Note: modelStatusLabel
is an object of type ToolStripStatusLabel
.