请求各位给我解答一下!(事件调用)
private void txtInput_TextChanged(object sender, EventArgs e)
{
String strInput = txtInput.Text.ToString().Trim();
SqlConnection myConnection = new SqlConnection
("server=localhost;database=ProductData;Trusted_Connection=yes;user id=;password=");
SqlDataAdapter orderdet = new SqlDataAdapter("select
pId,pName,pModel,pUnit,pColor,pPurchasePrice,pMinAmount from Product where pId like '%" +
strInput + "%' or pName like '%" + strInput + "%'", myConnection);
DataTable dt = new DataTable();
orderdet.Fill(dt);
dataProductBill.DataSource = dt.DefaultView;
//dataProductBill_CellMouseDoubleClick(dataProductBill,);
//想在这里调用dataProductBill_CellMouseDoubleClick()这个事件,但是总是报参数出错!
}
private void dataProductBill_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
try
{
//获取DataGirdView中的值
String strId = dataProductBill.CurrentRow.Cells["pId"].Value.ToString();
String strName = dataProductBill.CurrentRow.Cells["pName"].Value.ToString();
String strModel = dataProductBill.CurrentRow.Cells["pModel"].Value.ToString();
String strUnit = dataProductBill.CurrentRow.Cells["pUnit"].Value.ToString();
String strColor = dataProductBill.CurrentRow.Cells["pColor"].Value.ToString();
String strPuchasePrice = dataProductBill.CurrentRow.Cells["pConsultPrice"].Value.ToString();
String strMinAmount = dataProductBill.CurrentRow.Cells["pMinAmount"].Value.ToString();
String strManufacturer = dataProductBill.CurrentRow.Cells["pManufacturer"].Value.ToString();
String strRemark = dataProductBill.CurrentRow.Cells["pRemark"].Value.ToString();
FrmProductInfo fr = new FrmProductInfo(strId, strName, strModel, strUnit, strColor, strPuchasePrice, strMinAmount, strManufacturer, strRemark);
fr.Owner = this;
fr.ShowDialog();
label3.Text = strContent.ToString ();
label4.Text = strName;
label5.Text = strName1;
fr.Dispose();
fillData();
}
catch
{
MessageBox.Show("没有可选商品!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}