|
Listing 18-5 extracted from chapter Windows forms applications
Listing 18-4< > Listing 18-6
This listing can be compiled with the command line: csc.exe /target:exe Example_18_5.cs Errors: 5 Warnings: 0
Example_18_5.cs
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
// NOTE: The typed DataSet ORGANIZATIONDataSet must be declared
// in the namespace WindowsApplication1.
using WindowsApplication1;
using WindowsApplication1.ORGANIZATIONDataSetTableAdapters;
public class MyForm : Form {
public MyForm() {
InitializeComponent();
}
private void Form1_Load(System.Object sender, System.EventArgs e) {
depDataGridView.DataSource = dSet.DEPARTMENTS;
empDataGridView.DataSource = dSet.EMPLOYEES;
depTableAdapter.Fill(dSet.DEPARTMENTS);
empTableAdapter.Fill(dSet.EMPLOYEES);
}
private void InitializeComponent() {
this.components = new Container();
this.empDataGridView = new DataGridView();
this.depDataGridView = new DataGridView();
this.depTableAdapter = new DEPARTMENTSTableAdapter();
this.empTableAdapter = new EMPLOYEESTableAdapter();
this.dSet = new ORGANIZATIONDataSet();
((ISupportInitialize)(this.empDataGridView)).BeginInit();
((ISupportInitialize)(this.depDataGridView)).BeginInit();
((ISupportInitialize)(this.dSet)).BeginInit();
this.SuspendLayout();
empDataGridView.Dock = DockStyle.Fill;
depDataGridView.Dock = DockStyle.Fill;
SplitContainer splitContainer1 = new SplitContainer();
splitContainer1.Dock = DockStyle.Fill;
splitContainer1.Orientation = Orientation.Vertical;
splitContainer1.Panel1.Controls.Add(depDataGridView);
splitContainer1.Panel2.Controls.Add(empDataGridView);
this.Controls.Add(splitContainer1);
this.Text = "Form DEPARTMENTs/Employees";
this.Load += new System.EventHandler(this.Form1_Load);
((ISupportInitialize)(this.empDataGridView)).EndInit();
((ISupportInitialize)(this.depDataGridView)).EndInit();
((ISupportInitialize)(this.dSet)).EndInit();
this.ResumeLayout(false);
}
private IContainer components = null;
private DataGridView empDataGridView;
private DataGridView depDataGridView;
private DEPARTMENTSTableAdapter depTableAdapter;
private EMPLOYEESTableAdapter empTableAdapter;
private ORGANIZATIONDataSet dSet;
}
Copyright Patrick Smacchia 2006 2007
|