private void dataGridView_MouseDoubleClick(object sender, MouseEventArgs e)
{
StateTextboxes(true);
btnUpdate.Enabled = true;
btnDelete.Enabled = true;
btnNew.Enabled = false;
btnClear.Enabled = true;
StateTextboxes(true);
DataGridToTextBoxes();
}
private void DataGridToTextBoxes()
{
txtID.Text = dataGridView.CurrentRow.Cells["id"].Value.ToString();
id = Int32.Parse(txtID.Text);
txtCompany.Text = dataGridView.CurrentRow.Cells["Company"].Value.ToString();
txtFirstname.Text = dataGridView.CurrentRow.Cells["FirstName"].Value.ToString();
txtLastname.Text = dataGridView.CurrentRow.Cells["LastName"].Value.ToString();
}
private void TextChanged_Search_Load(object sender, EventArgs e)
{
searchData("");
}
private void txtSearch_TextChanged(object sender, EventArgs e)
{
searchData(txtSearch.Text);
}
private void searchData(string text)
{
using (MySqlConnection mySqlConnection = new MySqlConnection(stdConnection))
{
mySqlConnection.Open();
MySqlDataAdapter msda = new MySqlDataAdapter("BC_Search", mySqlConnection);
msda.SelectCommand.CommandType = CommandType.StoredProcedure;
msda.SelectCommand.Parameters.AddWithValue("_SearchValue", txtSearch.Text);
DataTable dt = new DataTable();
msda.Fill(dt);
dataGridView.DataSource = dt;
throw new NotImplementedException();
}
}
另请查看这篇文章:文本更改事件未触发
需要仔细检查的关键注释,因为这些注释始终是必需的:
“您需要将 AutoPostBack 设置为 true。”。
和:
“