private void btnAddFile_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); if (d.ShowDialog() == DialogResult.OK) { string[] l = CTHelper.LoadTxtByLine(d.FileName); if (MessageBox.Show("Add " + l.Length + " records?", "Note", MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (string s in l) { if (s.Trim() == "") { continue; } tbParas.Text = s; Application.DoEvents(); System.Threading.Thread.Sleep(2000); btnAdd_Click(sender, e); } } } }