從另外一個視窗回傳
private void Button17_Click(object sender, EventArgs e)
{
FrmLab4_input fi = new FrmLab4_input();
if (fi.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
//==========可能會key錯欄位
//DataRow dw = this.northwindDataSet.Products.NewRow();
////row不能自己new出來,要依附在某個table
//dw["ProductName"] = fi.textBox1.Text;
//dw["Discontinued"] = fi.checkBox1.Checked;
//this.northwindDataSet.Products.Rows.Add(dw);
//this.productsBindingSource.MoveLast();
//======================強型別
NorthwindDataSet.ProductsRow dw = this.northwindDataSet.Products.NewProductsRow();
dw.ProductName = fi.textBox1.Text; //直接能用
dw.Discontinued = fi.checkBox1.Checked;
this.northwindDataSet.Products.Rows.Add(dw);
this.productsBindingSource.MoveLast();
}