Home
Browse all 647 examples
Download all 647 examples
Download sample chapters
Reviews
Errata
Acknowledgments
Links on .NET
Paradoxal Press
Buy directly from Paradoxal Press at $33.99 (Save 43%)
Category: Programming
Level: Beginner to seasoned
900 pages
ISBN-10 097661322-0
ISBN-13 978-097661322-0
$59.99 USA
$79.99 CANADA
|
Listing 18-6 extracted from chapter Windows forms applications
Listing 18-5< > Listing 18-7
This listing can be compiled with the command line: csc.exe /target:exe Example_18_6.cs Errors: 5 Warnings: 0
Example_18_6.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 partial class MyForm : Form {
public MyForm() {
InitializeComponent();
}
private void Form1_Load(System.Object sender, System.EventArgs e) {
depDataGridView.DataSource = depBindingSource;
empDataGridView.DataSource = empBindingSource;
depTableAdapter.Fill(dSet.DEPARTMENTS);
empTableAdapter.Fill(dSet.EMPLOYEES);
depBindingSource.DataSource = dSet;
depBindingSource.DataMember = "DEPARTMENTS";
empBindingSource.DataSource = depBindingSource;
empBindingSource.DataMember = "Is_Employed_By";
}
private void InitializeComponent() {
this.components = new Container();
this.empDataGridView = new DataGridView();
this.depDataGridView = new DataGridView();
this.depBindingSource = new BindingSource(this.components);
this.empBindingSource = new BindingSource(this.components);
this.depTableAdapter = new DEPARTMENTSTableAdapter();
this.empTableAdapter = new EMPLOYEESTableAdapter();
this.dSet = new ORGANIZATIONDataSet();
((ISupportInitialize)(this.empDataGridView)).BeginInit();
((ISupportInitialize)(this.depDataGridView)).BeginInit();
((ISupportInitialize)(this.depBindingSource)).BeginInit();
((ISupportInitialize)(this.empBindingSource)).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.depBindingSource)).EndInit();
((ISupportInitialize)(this.empBindingSource)).EndInit();
((ISupportInitialize)(this.dSet)).EndInit();
this.ResumeLayout(false);
}
private IContainer components = null;
private DataGridView empDataGridView;
private DataGridView depDataGridView;
private BindingSource depBindingSource;
private BindingSource empBindingSource;
private DEPARTMENTSTableAdapter depTableAdapter;
private EMPLOYEESTableAdapter empTableAdapter;
private ORGANIZATIONDataSet dSet;
}
Copyright Patrick Smacchia 2006 2007
|