public void OpenUpForm(object sender, EventArgs e)
{
if (forms.Count == numberoftimes)
{
forms.ForEach(f =>
{
f.Close();
f.Dispose();
});
forms.Clear();
//Need Delay Here
return;
}
forms.Add(new Form1());
forms.Last().Show();
}
Hello I have this code, I need to add delay after forms.Clear();
But im new to coding i couldnt figure it out.
I have tryed with Task.Delay
and Thread.Sleep
but it locks my user interface. Is it possible to add a delay that dosent lock the application? Thank you.