private void EffacerTextBoxClient() { TextBoxNom.Clear(); TextBoxPrenom.Clear(); dateTimeDateNaissance.ResetText(); TextBoxPays.Clear(); TextBoxVille.Clear(); TextBoxMail.Clear(); TextBoxTel.Clear(); TextBoxNouveauNom.Clear(); TextBoxNouveauPrenom.Clear(); dateTimeNouvelleDateNaissance.ResetText(); TextBoxNouveauPays.Clear(); TextBoxNouvelleVille.Clear(); TextBoxNouveauMail.Clear(); TextBoxNouveauTel.Clear(); ListeClientModif.Text = ""; ListeClientSuppr.Text = ""; }
private void ButtonSearchByTel_Click(object sender, EventArgs e) { try { if (GlobalClass.Connection.State == ConnectionState.Open) { GlobalClass.Connection.Close(); } GlobalClass.Connection.Open(); if (Regex.IsMatch(TextBoxTel.Text, @"1\d{10}")) { SqlCommand SearchByTelCmd = new SqlCommand("select * from ViewMemberInformation where Tel=" + TextBoxTel.Text, GlobalClass.Connection); SqlDataReader data = SearchByTelCmd.ExecuteReader(); data.Read(); for (int i = 0; i < MemberList.Count; i++) { if (((UserControlMemberList)MemberList[i]).Controls["LabelTel"].Text.Substring(7) == data[3].ToString()) { this.PanelMemberList.Controls.Clear(); this.PanelMemberList.Controls.Add((UserControlMemberList)MemberList[i]); } } data.Close(); } else { MessageBox.Show("输入不合法!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBoxTel.Text = String.Empty; TextBoxTel.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "消息", MessageBoxButtons.OK, MessageBoxIcon.Error); GlobalClass.Connection.Close(); } }