I have three datagridviews (Department, Employee, EmployeeNotInDepartment). I have populated the Department and Employee datagridviews based on DataRelations (see below). I'm thinking there has to be an obviously easy way to populate the EmployeeNotInDepartment datagridview. Any ideas? I'm hoping that I do not have to use linq.
public Form1()
{
InitializeComponent();
dtDepartment = FillDepartmentList();
dtEmployee = FillEmployeeList();
dsDepartmentEmployees = new DataSet();
// Add tables to dataset
dsDepartmentEmployees.Tables.Add(dtDepartment);
dsDepartmentEmployees.Tables.Add(dtEmployee);
// Create table relationship
dsDepartmentEmployees.Relations.Add("DepartEmpRelation", dtDepartment.Columns["DepartmentNumber"], dtEmployee.Columns["DepartmentNumber"],true);
BindingSource bsDepartment = new BindingSource();
bsDepartment.DataSource = dsDepartmentEmployees;
bsDepartment.DataMember = "table1";
BindingSource bsEmployee = new BindingSource();
bsEmployee.DataSource = bsDepartment;
bsEmployee.DataMember = "DepartEmpRelation";
dataGridView1.DataSource = bsDepartment;
dataGridView2.DataSource = bsEmployee;
}