private void btnSend_Click(object sender, EventArgs e) { if (comboBox1.Items.Count == 0) { MessageBox.Show("Add Group Please !"); return; } Contacts.Service1 sr2 = new Contacts.Service1(); BindingSource b = new BindingSource(); b.DataSource = sr2.SSTC(myUtill.loginUser.Userid, comboBox1.SelectedValue.ToString()); foreach (DataGridViewRow gv in gvSMS.Rows) { string s = gv.Cells[3].Value.ToString(); { RecPwdbySMS sm = new RecPwdbySMS(); sm.SetComPort("com4"); sm.Opens(); sm.RecoverPwdbySMS(s, textBox1.Text.Trim()); sm.Closes(); } System.Threading.Thread.Sleep(10000); } MessageBox.Show("Your message has been sent"); }