private void Job_Work(object sender, DoWorkEventArgs e) { try { if (!string.IsNullOrEmpty(poisonTextBox1.Text) && !string.IsNullOrWhiteSpace(poisonTextBox1.Text) && !poisonTextBox1.Text.StartsWith("0") && !poisonTextBox1.Text.Contains(" ")) { poisonButton3.Enabled = false; poisonButton4.Enabled = false; int Count = Convert.ToInt32(poisonTextBox1.Text); Random RNDM = new(); for (int C = 0; C < Count; C++) { string GTCN = NO.Create(RNDM); if (!listBox1.Items.Contains(GTCN)) { listBox1.Items.Add(GTCN); poisonLabel1.Text = "Eleman Sayısı: " + listBox1.Items.Count; listBox1.SelectedIndex = listBox1.Items.Count - 1; } else { C--; } } poisonButton3.Enabled = true; poisonButton4.Enabled = true; } else { PoisonMessageBox.Show(this, "Üretilecek TC NO Sayısını Belirtiniz!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { PoisonMessageBox.Show(this, "Hatalı Bir TC NO Sayısı Girdiniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } }