dataform.cs

来自「微软(Microsoft)出版社C井练习文件及解答」· CS 代码 · 共 40 行

CS
40
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DisplayProducts
{
	public partial class DataForm : Form
	{
		public DataForm()
		{
			InitializeComponent();
		}

		private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
		{
			if (this.Validate())
			{
				this.suppliersBindingSource.EndEdit();
				this.suppliersTableAdapter.Update(this.northwindDataSet.Suppliers);
			}
			else
			{
				System.Windows.Forms.MessageBox.Show(this, "Validation errors occurred.", "Save", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
			}
		}

		private void DataForm_Load(object sender, EventArgs e)
		{
			// TODO: This line of code loads data into the 'northwindDataSet.Products' table. You can move, or remove it, as needed.
			this.productsTableAdapter.Fill(this.northwindDataSet.Products);
			// TODO: This line of code loads data into the 'northwindDataSet.Suppliers' table. You can move, or remove it, as needed.
			this.suppliersTableAdapter.Fill(this.northwindDataSet.Suppliers);

		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?