datagridview数据绑定textbox textbox数据添加datagridview
将明细中的textbox.text添加到下方的datagridview内并清空textbox文本框,并将光标定位到指定位置
private void btnDetail_Click(object sender, EventArgs e)//增加明细
{
//datagrid数据绑定
dataGridView1.Rows.Add(cmbCategory.Text, txtBrand.Text, txtSpecifications.Text, txtUnitPrice.Text, txtNumber.Text, txtWarranty.Text);
cmbCategory.Text = "";
txtBrand.Text = "";
txtSpecifications.Text = "";
txtUnitPrice.Text = "";
txtNumber.Text = "";
txtWarranty.Text = "";
cmbCategory.Focus(); //指定光标位置
}