good morning am using C# to develop pc software and am using this method in my software to delay loop between lines
System.Threading.Thread.Sleep(x);
but this make my software freeze . how to do this method work with out freeze my application my full code
private void button18_Click_3(object sender, EventArgs e)
{
for (int i = 0; i < lstgroups.Items.Count; i++)
{
//
System.Threading.Thread.Sleep(x);
System.Windows.Forms.Application.EnableVisualStyles();
//
timeless.Enabled = true;
timeless.Start();
duration--;
if (duration == 0)
{
timeless.Start();
}
if (Gsend.Post(lstgroupsbox.Items[i].ToString(), AppSettings.Default.AccessToken, txtStatus.Text, txtLink.Text) == true)
lblshow.Text = "Sent To : " + lstgroups.Items[i].Text;
lblsendid.Text = "Sent To : " + lstgroupsbox.Items[i];
{
//foreach (var item in lstgroups.Items)
//{
// if (Gsend.Post(item.ToString(), "", txtStatus.Text, "", 2, "", txtImagePath.Text) == true)
// MessageBox.Show("Post Has Been Sent");
//}
}