ステップ、
- 単一フォームのクレート ウィンドウ アプリケーション
- データから新しいデータソースを追加 -> 新しいデータソースを追加
- データに移動->データソースを表示
- 任意のテーブルをフォームにドロップします。この手順では、牽引コントロールを追加します。a. DataGridView b. バインディングナビゲーター
F5 を押して実行します。
すべてのレコードを表示できますが、追加/更新/削除を行うことができません。
以下は、VS によって生成されるフォームのコードです。
namespace TestingGrid
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void testBindingNavigatorSaveItem_Click( object sender, EventArgs e )
{
this.Validate();
this.testBindingSource.EndEdit();
this.testTableAdapter.Update( this.testDataSet.Test );
}
private void Form1_Load( object sender, EventArgs e )
{
// TODO: This line of code loads data into the 'testDataSet.Test' table. You can move, or remove it, as needed.
this.testTableAdapter.Fill( this.testDataSet.Test );
}
}
}