private void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtRequestContent.Text)) { string content = txtRequestContent.Text; Request hp = new Request(s.StuID, DateTime.Now.ToString(), content, "", "", "", 1); RequestDAO.Insert(hp); MessageBox.Show("Request Success"); DataTable dt = RequestDAO.GetDataTableByStuID(s.StuID); DataView dv = new DataView(dt); string filter = ""; if (comboBox1.SelectedIndex == 0) { filter = "maID is not null"; } if (comboBox1.SelectedIndex == 1) { filter = "maID is null"; } dv.RowFilter = filter; dataGridView1.DataSource = dv; btnSave.Enabled = false; txtRequestContent.Enabled = false; txtRequestContent.Text = ""; btnCancel.Enabled = false; btnRequest.Enabled = true; } else { MessageBox.Show("TextFiled is not empty"); } }