private void Age_Click(object sender, EventArgs e) { if (Age.Text.Equals("Age")) { Age.Clear(); } }
MyBllDemo bllDemo = new MyBllDemo(); //定义一个BLL层的类 private void btnAdd_Click(object sender, EventArgs e) { #region 面向过程:任务逐语句执行 //if(bllDemo.Operate(pName.Text, Age.Text, Sex.Text) > 0) //{ // MessageBox.Show("添加成功"); // pName.Clear(); // Age.Clear(); // Sex.Clear(); //} #endregion //面向对象:逐过程 InitData(); MyModelDemo model = new MyModelDemo(); if (bllDemo.Operate() > 0) { MessageBox.Show("添加成功"); pName.Clear(); Age.Clear(); Sex.Clear(); } Update(); }
private void btnModify_Click(object sender, EventArgs e) { if (txtID.Text.Length <= 0) { MessageBox.Show("请输入要修改的编号"); return; } else { if (mysql.Show("update Person set Name='" + Name.Text + "', Age = '" + Age.Text + "',Sex = '" + Sex.Text + "' where ID='" + txtID.Text + "' ") > 0) { MessageBox.Show("修改成功"); Name.Clear(); txtID.Clear(); Age.Clear(); Sex.Clear(); readContent.Items.Clear(); read(); } else { MessageBox.Show("没有该内容"); } } }
private void clearBox() { name.Clear(); Surname.Clear(); Age.Clear(); ImageWay.Clear(); Number.Clear(); PersonImage.Source = null; }
private void ClearContent() { if (controller.PersonCount == 0) { FirstName.Clear(); LastName.Clear(); Age.Clear(); TelePhoneNo.Clear(); } else { FirstName.Text = controller.CurrentPerson.FirstName; LastName.Text = controller.CurrentPerson.LastName; Age.Text = controller.CurrentPerson.Age.ToString(); TelePhoneNo.Text = controller.CurrentPerson.TelephoneNo; } }
private void Insertbtn_Click(object sender, EventArgs e) { string connStr = "server=localhost;user=root;database=birjha_truda;"; // создаём объект для подключения к БД MySqlConnection connection = new MySqlConnection(connStr); connection.Open(); string sql = "INSERT INTO `soiskateli`(`id_users`, `Last_name`, `Name`, `Father_name`, `Pol`, `Age`, `Pasport`, `Info`) VALUES " + "(NULL, '" + Fam.Text + "','" + Ima.Text + "','" + Otch.Text + "','" + Pol.Text + "','" + Age.Text + "','" + Pasport.Text + "','" + Inf.Text + "');"; MySqlCommand command = new MySqlCommand(sql, connection); command.ExecuteNonQuery(); connection.Close(); Ima.Clear(); Fam.Clear(); Otch.Clear(); Pol.Clear(); Pasport.Clear(); Age.Clear(); Inf.Clear(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { int Age1 = int.Parse(Age.Text); string firstname = FirstName.Text; string lastname = LastName.Text; string city = City.Text; Age.Clear(); FirstName.Clear(); LastName.Clear(); City.Clear(); NoteBook NT = new NoteBook(Age1, firstname, lastname, city, answers[0], answers[1]); people.Add(NT); StreamWriter s = new StreamWriter(@"../../information.txt", append: true); s.WriteLine(NT.__Age); s.WriteLine(NT.__FirstName); s.WriteLine(NT.__LastName); s.WriteLine(NT.__City); s.Close(); }
MyVar mysql = new MyVar(); //定义一个myVar类 private void btnAdd_Click(object sender, EventArgs e) { if (Name.Text.Length <= 0) { MessageBox.Show("请输入下面相关信息"); return; } else { if (mysql.Show("insert into Person(Name, Age, Sex) values('" + Name.Text + "', '" + Age.Text + "', '" + Sex.Text + "')") > 0) { MessageBox.Show("添加成功"); Name.Clear(); Age.Clear(); Sex.Clear(); readContent.Items.Clear(); read(); } else { MessageBox.Show("添加失败"); } } }
// Makes the three dots in the boxes disappear private void AgeTextBoxClick(object sender, MouseButtonEventArgs e) { Age.Clear(); }
private void Age_Click(object sender, EventArgs e) { Age.Clear(); }