2 つのグリッドを持つマスター詳細フォームがあります: 顧客 = マスター、注文 = 詳細。マスター グリッドから新しい顧客を選択するときに詳細を更新するにはどうすればよいですか? これが私のコードです:
public partial class Form1 : Form
{
AutoLotEntities context = new AutoLotEntities();
BindingSource customerBindingSource;
BindingSource orderBindingSource;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
customerBindingSource = new BindingSource();
orderBindingSource = new BindingSource();
customerBindingSource.DataSource = context.Customers;
orderBindingSource.DataMember = "Orders";
orderBindingSource.DataSource = customerBindingSource.DataSource;
grdCustomers.DataSource = customerBindingSource;
grdOrders.DataSource = orderBindingSource;
}
}
Form1.Desginer.cs の IDE 生成コードの助けを借りてそれを行うことができましたが、このことがどのように機能するかを確認するために、生成されていないコードを手動で実行したいと考えています。