|
The Form design,
About.cs
Create Visual Basic .Net Forn - About.cs
Classes used in this Form: OleDbConnection,
OleDbDataAdapter, DataSet,
PictureBox, Label,
TextBox, Button
- On the View menu ,
click Solution Explorer
- In Solution
Explorer, right click the App-VCSNet, select Add
on the shortcut menu to open other shortcut menu, click
Add New Item, the Add New Item - App-VCSNet dialog
box appears.
- In the Add New
Item -App-VCSNet dialog box:
- In the Categories
pane, select Local Project Items
- In the Templates
pane, select Data Form Wizard . A message
appears - (a form for Windows
Applications).
Note:
The
Data Form Wizard create Windows Form with
data-bound controls. The controls display data from any
data source you specify. The data component for this form
consists:
- A
connection to a data source-(her the datasource -
C:\App-VCSNet\Pic\KJV2002.mdb.
- A data
adapter .
- A typed
dataset to hold the records fetched from the
database
|
- In the Name
box, type About.cs
- Click Open, the
Data Form Wizard dialog box appears.
|
the
Data Form Wizard will create a new form with data-bound
controls.
- In the 1st page of
this dialog, click Next
- In the 2nd page,
select the Create a new dataset named
radioButton,
in the box type Aboutdset and
then click Next
- In the 3rd page,
click New Connection, the Data Link Properties
dialog box appears.
- In the Provider
tab of the Data Link Properties dialog box,
select Microsoft Jet 4.0 OLEDB Provider and then
click Next
- In the
Connection tab, in the Select or enter a database
name box type C:\App-VCSNet\Pic\KJV2002.mdb and then click
Ok
|
and then click
Next.
- In the 4th page,
pick and move the BibleTable from the Available
item(s) list to the Selected item(s) list and then
click Next
- In the 5th page,
from the Master or Single table combobox select
BibleTable, from the Columns list check only the
TextData checkbox and then click Next
- In the 6th page,
select the Single record in individual controls radio
button, uncheck (remove selected) all check boxes and then click
Finish, the do you want to include the password in the
connection string dialog box appears.
In this dialog click
Don't include password.
Note: In
the Windows Forms Designer appears the design
form created and in the Properties Windows displays the
corresponding properties
The design Form created
...
The Code Created
...
using
System; using
System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace App_VCSNet
{
///
<summary>
///
Summary description for About.
///
</summary>
public
class
About : System.Windows.Forms.Form
{
private
System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private
System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private
System.Data.OleDb.OleDbConnection oleDbConnection1;
private
System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
private
App_VCSNet.Aboutdset objAboutdset;
private
System.Windows.Forms.Button btnLoad;
private
System.Windows.Forms.Button btnUpdate;
private
System.Windows.Forms.Label lblTextData;
private
System.Windows.Forms.TextBox editTextData;
///
<summary>
///
Required designer variable.
///
</summary>
private
System.ComponentModel.Container components =
null;
public
About()
{
//
// Required for
Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add
any constructor code after InitializeComponent call
//
}
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override
void
Dispose( bool
disposing )
{
if(
disposing )
{
if(components
!= null)
{
components.Dispose();
}
}
base.Dispose(
disposing );
}
#region Windows Form Designer
generated code
///
<summary>
///
Required method for Designer support - do not modify
///
the contents of this method with the code editor.
///
</summary>
private
void
InitializeComponent()
{
this.oleDbSelectCommand1
= new
System.Data.OleDb.OleDbCommand();
this.oleDbInsertCommand1
= new
System.Data.OleDb.OleDbCommand();
this.oleDbConnection1
= new
System.Data.OleDb.OleDbConnection();
this.oleDbDataAdapter1
= new
System.Data.OleDb.OleDbDataAdapter();
this.objAboutdset
= new
App_VCSNet.Aboutdset();
this.btnLoad
= new
System.Windows.Forms.Button();
this.btnUpdate
= new
System.Windows.Forms.Button();
this.lblTextData
= new
System.Windows.Forms.Label();
this.editTextData
= new
System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)( this.objAboutdset)).BeginInit();
this.SuspendLayout();
//
//
oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText
= "SELECT Book, BookTitle, Chapter, TextData, Verse FROM
BibleTable";
this.oleDbSelectCommand1.Connection
= this.oleDbConnection1;
//
//
oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText
= "INSERT INTO BibleTable(Book, BookTitle, Chapter,
TextData, Verse) VALUES (?, ?, ?" +
", ?, ?)";
this.oleDbInsertCommand1.Connection
= this.oleDbConnection1;
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Book",
System.Data.OleDb.OleDbType.VarWChar, 50, "Book"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("BookTitle",
System.Data.OleDb.OleDbType.VarWChar, 50, "BookTitle"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Chapter",
System.Data.OleDb.OleDbType.VarWChar, 50, "Chapter"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("TextData",
System.Data.OleDb.OleDbType.VarWChar, 0, "TextData"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Verse",
System.Data.OleDb.OleDbType.VarWChar, 50, "Verse"));
//
//
oleDbConnection1
//
this.oleDbConnection1.ConnectionString
= @"Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database Locking
Mode=1;Data Source=""C:\App_VCSNet\pic\KJV2002.mdb"";Jet
OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet
OLEDB:System database=;Jet OLEDB:SFP=False;persist
security info=False;Extended Properties=;Mode=Share Deny
None;Jet OLEDB:Create System Database=False;Jet
OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet
OLEDB:Encrypt Database=False";
//
//
oleDbDataAdapter1
//
this.oleDbDataAdapter1.InsertCommand
= this.oleDbInsertCommand1;
this.oleDbDataAdapter1.SelectCommand
= this.oleDbSelectCommand1;
this.oleDbDataAdapter1.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new
System.Data.Common.DataTableMapping("Table", "BibleTable",
new
System.Data.Common.DataColumnMapping[] {
new
System.Data.Common.DataColumnMapping("Book", "Book"),
new
System.Data.Common.DataColumnMapping("BookTitle", "BookTitle"),
new
System.Data.Common.DataColumnMapping("Chapter",
"Chapter"),
new
System.Data.Common.DataColumnMapping("TextData", "TextData"),
new
System.Data.Common.DataColumnMapping("Verse",
"Verse")})});
//
// objAboutdset
//
this.objAboutdset.DataSetName
= "Aboutdset";
this.objAboutdset.Locale
= new
System.Globalization.CultureInfo("en-US");
//
// btnLoad
//
this.btnLoad.Location
= new
System.Drawing.Point(10, 10);
this.btnLoad.Name
= "btnLoad";
this.btnLoad.TabIndex
= 0;
this.btnLoad.Text
= "&Load";
this.btnLoad.Click
+= new
System.EventHandler(this.btnLoad_Click);
//
// btnUpdate
//
this.btnUpdate.Location
= new
System.Drawing.Point(145, 10);
this.btnUpdate.Name
= "btnUpdate";
this.btnUpdate.TabIndex
= 1;
this.btnUpdate.Text
= "&Update";
this.btnUpdate.Click
+= new
System.EventHandler(this.btnUpdate_Click);
//
// lblTextData
//
this.lblTextData.Location
= new
System.Drawing.Point(10, 43);
this.lblTextData.Name
= "lblTextData";
this.lblTextData.TabIndex
= 2;
this.lblTextData.Text
= "TextData";
//
// editTextData
//
this.editTextData.DataBindings.Add(new
System.Windows.Forms.Binding("Text",
this.objAboutdset,
"BibleTable.TextData"));
this.editTextData.Location
= new
System.Drawing.Point(120, 43);
this.editTextData.Name
= "editTextData";
this.editTextData.TabIndex
= 3;
this.editTextData.Text
= "";
//
// About
//
this.AutoScaleBaseSize
= new
System.Drawing.Size(5, 13);
this.ClientSize
= new
System.Drawing.Size(344, 109);
this.Controls.Add(this.btnLoad);
this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.lblTextData);
this.Controls.Add(this.editTextData);
this.Name
= "About";
this.Text
= "About";
((System.ComponentModel.ISupportInitialize)( this.objAboutdset)).EndInit();
this.ResumeLayout(false);
}
#endregion
public
void
FillDataSet(App_VCSNet.Aboutdset dataSet)
{
// Turn off
constraint checking before the dataset is filled.
// This allows
the adapters to fill the dataset without concern
// for
dependencies between the tables.
dataSet.EnforceConstraints =
false;
try
{
// Open the
connection.
this.oleDbConnection1.Open();
// Attempt to
fill the dataset through the OleDbDataAdapter1.
this.oleDbDataAdapter1.Fill(dataSet);
}
catch
(System.Exception fillException)
{
// Add your
error handling code here.
throw
fillException;
}
finally
{
// Turn
constraint checking back on.
dataSet.EnforceConstraints =
true;
// Close the
connection whether or not the exception was thrown.
this.oleDbConnection1.Close();
}
}
public
void
UpdateDataSource(App_VCSNet.Aboutdset ChangedRows)
{
try
{
// The data
source only needs to be updated if there are changes
pending.
if
((ChangedRows !=
null))
{
// Open the
connection.
this.oleDbConnection1.Open();
// Attempt to
update the data source.
oleDbDataAdapter1.Update(ChangedRows);
}
}
catch
(System.Exception updateException)
{
// Add your
error handling code here.
throw
updateException;
}
finally
{
// Close the
connection whether or not the exception was thrown.
this.oleDbConnection1.Close();
}
}
public
void
LoadDataSet()
{
// Create a new
dataset to hold the records returned from the call to
FillDataSet.
// A temporary
dataset is used because filling the existing dataset
would
// require the
databindings to be rebound.
App_VCSNet.Aboutdset objDataSetTemp;
objDataSetTemp =
new
App_VCSNet.Aboutdset();
try
{
// Attempt to
fill the temporary dataset.
this.FillDataSet(objDataSetTemp);
}
catch
(System.Exception eFillDataSet)
{
// Add your
error handling code here.
throw
eFillDataSet;
}
try
{
// Empty the
old records from the dataset.
objAboutdset.Clear();
// Merge the
records into the main dataset.
objAboutdset.Merge(objDataSetTemp);
}
catch
(System.Exception eLoadMerge)
{
// Add your
error handling code here.
throw
eLoadMerge;
}
}
public
void
UpdateDataSet()
{
// Create a new
dataset to hold the changes that have been made to the
main dataset.
App_VCSNet.Aboutdset objDataSetChanges =
new
App_VCSNet.Aboutdset();
// Stop any
current edits.
this.BindingContext[objAboutdset,"BibleTable"].EndCurrentEdit();
// Get the
changes that have been made to the main dataset.
objDataSetChanges = ((App_VCSNet.Aboutdset)(objAboutdset.GetChanges()));
// Check to see
if any changes have been made.
if
((objDataSetChanges !=
null))
{
try
{
// There are
changes that need to be made, so attempt to update the
datasource by
// calling the
update method and passing the dataset and any
parameters.
this.UpdateDataSource(objDataSetChanges);
objAboutdset.Merge(objDataSetChanges);
objAboutdset.AcceptChanges();
}
catch
(System.Exception eUpdate)
{
// Add your
error handling code here.
throw
eUpdate;
}
// Add your
code to check the returned dataset for any errors that
may have been
// pushed into
the row object's error.
}
}
private
void
btnLoad_Click(object
sender, System.EventArgs e)
{
try
{
// Attempt to
load the dataset.
this.LoadDataSet();
}
catch
(System.Exception eLoad)
{
// Add your
error handling code here.
// Display
error message, if any.
System.Windows.Forms.MessageBox.Show(eLoad.Message);
}
}
private
void
btnUpdate_Click(object
sender, System.EventArgs e)
{
try
{
// Attempt to
update the datasource.
this.UpdateDataSet();
}
catch
(System.Exception eUpdate)
{
// Add your
error handling code here.
// Display
error message, if any.
System.Windows.Forms.MessageBox.Show(eUpdate.Message);
}
}
}
} | | |
- From the CD-Rom -
Teach_VNet, copy the bmp file
diam1.bmp
(\\App-VCSNet\Pic\diam1.bmp)
to the folder-
c:\App-VCSNet\Pic
- On the Projet
menu , click Add Existing Item ..., Add
Existing Item - App-VCSBNet dialog box appears, select the files
diam1.bmp
of the folder c:\App-VCSNet\Pic, and then click
Open.
|
1. |
The About.cs
design |
|
 |
The Properties of the
Form - About.cs... |
|
Old |
New |
Name: Icon: Maximize: Menu: Size: Start
Position: Text: Window
State: |
About Icon True (none) 400,250 WindowsDefaultLocation About Normal |
About Icon False (none) 368,216 CenterScreen About Normal | | | |
2. |
List of controls created by the Data Form Wizard
... One OleDbConnection control, one
OleDbDataAdapter control, one DataSet control,
one Label control, one TextBox control and two
Button control |
|
- The
OleDbConnection
control, created by ...
Represents an open connection to a data
source The OleDbConnection
object of the .NET Framework Data Provider for OLE DB
provides connectivity to data sources exposed using
OLE DB The .NET Framework Data Provider for OLE DB
automatically pools connections using OLE DB session
pooling. Connection string arguments can be used to
enable or disable OLE DB services including
pooling. It is recommended
that you always close the Connection when you
are finished using it
The
OleDbConnection1
Properties:
Name: ConnectionString: |
OleDbConnection1 Jet
OLEDB:Global Partial
.... | |
Note: Connection info
:
Provider =
Microsoft.Jet.OLEDB.4.0
Data source = C:\App-VCSNet\Pic\KJV2002.mdb
- The OleDbDataAdapter
control, created by
...
Represents a set of data
commands and a database connection that are used to
fill the DataSet and update the
data source. The OleDbDataAdapter
serves as a bridge between a DataSet and data
source for retrieving and saving data.
The
OleDbDataAdapter1Properties:
Name: InsertCommand:
CommandText:
CommandTime:
CommandType: Connection: Parameters: SelectCommand:
CommandText:
CommandTime:
CommandType: |
OleDbDataAdapter1 OleDbInsertCommand1 INSERT
INTO BibleTable(Book, BookTitle, Chapter,
TextData, Verse) VALUES (?, ?, ?, ?,
?) 30 Text OleDbConnection1 (Colection) OleDbSelectCommand1 SELECT
Book, BookTitle, Chapter, TextData, Verse FROM
BibleTable 30 Text | |
In
OleDbDataAdapter1
Properties, when you click
Collection of Parameters property,
the OleDbParameter Collection Editor dialog box
appears This Editor is displayed
when you are using the Properties window to
configure a data adapter on a form or
component.
- The DataSet
control, created by
...
Datasets store
data in a disconnected cache. The structure of
a dataset is similar to that of a relational
database; it exposes a hierarchical object model
of tables, rows, and columns. In addition, it contains
constraints and relationships defined for the
dataset.
The
objKJV2002dset
Properties:
Name: DataSetName: |
objKJV2002dset KJV2002dset | |
- The TextBox control, created by
... - EditTextData
Properties:
DataBindings
Text: Name: BackColor: BorderStyle: Font: Locked: Multiline: Size: Text: |
objKJV2002dset
-
BibleTable.TextData EditTextData Window Fixed3D Microsoft
Sons Serief,
8.25pt False False 100,20 | |
- The Label control, created by
... - lblTextData
Properties:
Name: Text: |
lblTextData TextData | |
- The Button control, created by
... - btnLoad
Properties:
Name: Size: Text: |
btnLoad 75,23 &Load | |
- The Button control, created by
... - btnUpdate
Properties:
Name: Size: Text: |
btnUpdate 75,23 &Update | | | |
3. |
a- |
Remove the following controls
created by Wizard: one Label control -
lbTextData and two Button
controls - btnLoad and
btnUpdate |
b- |
Modify the
Properties of the TextBox
control - EditTextData:
DataBindings
Text: Name: BackColor: BorderStyle: Font: Locked: Multiline: Size: |
objKJV2002dset
-
BibleTable.TextData EditTextData Control None Times
New Roman,
9.75pt True True 264,88 | |
Display the 1st record of the KJV2002.mdb
database Access file |
c-- |
From the Toolbox/Windows Form add
these controls .... One
PictureBox control, two
Label controls and two
Button controls. | |
|
- Add the PictureBox
control - PictureBox1,
PictureBox Properties:
Name: Image: Size
Mode: |
PictureBox1 System.Drawing.Bitmap Autosize | |
Bitmap file
added =
C:\App-VCSNet\Pic\diam1.bmp
- Add the Label
control
- Label1, Label
Properties:
Name: Font: Size: Text: TextAlign: |
Label1 Times New Roman,
9.75pt, style=Bold, Italic 150,16 KJV2002 database
info: TopLeft |
|
- Add the Label
control
- Label2, Label
Properties:
Name: Font: Size: Text: TextAlign: |
Label2 Times New Roman,
9.75pt, style=Bold, Italic 150,16 developed with
Visual C# .Net TopLeft | |
- Add the Label
control
- Line1,
Label Properties:
Name: BackColor: Size: Text: |
Line1 Windows
Text 264,1 | |
- Add the Button
control - btnbiography, Button
Properties:
Name: BackColor: Size: Text: |
btnbiograohy Scrollbar 80,24 Created
by | |
- Add the Button
control - btnDone, Button
Properties:
Name: BackColor: Size: Text: |
btnDone Scrollbar 80,24 Done | | | | |
|
About.cs file, the codes after modification
...
The text
Code
is red color & bold, corresponding to Load data in the Statusbar
control The
text
Code is Maroon color & Bold, corresponding to
activate the button btnbiography
The text Code is navy color & Bold,
correspondig to public access on one or more
declared programming elements
|
|
using
System; using
System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace App_VCSNet
{
///
<summary>
///
Summary description for About.
///
</summary>
public
class
About : System.Windows.Forms.Form
{
private
System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
private
App_VCSNet.Aboutdset objAboutdset;
internal
System.Windows.Forms.Label Label7;
private
System.Windows.Forms.Label label1;
private
System.Windows.Forms.GroupBox groupBox1;
private
System.Windows.Forms.Button btnbiography;
private
System.Windows.Forms.PictureBox pictureBox1;
private
System.Windows.Forms.Button btnDone;
private
System.Windows.Forms.TextBox editTextData;
///
<summary>
///
Required designer variable.
///
</summary>
private
System.ComponentModel.Container components =
null;
private
System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private
System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private
System.Data.OleDb.OleDbConnection oleDbConnection1;
// Declaration,
MainForm Form
App_VCSNet.MainForm fm =
new
MainForm();
public
About()
{
//
// Required for
Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any
constructor code after InitializeComponent call
//
}
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override
void
Dispose( bool
disposing )
{
if(
disposing )
{
if(components
!= null)
{
components.Dispose();
}
}
base.Dispose(
disposing );
}
#region Windows Form Designer
generated code
///
<summary>
///
Required method for Designer support - do not modify
///
the contents of this method with the code editor.
///
</summary>
private
void
InitializeComponent()
{
System.Resources.ResourceManager resources =
new
System.Resources.ResourceManager(typeof(About));
this.oleDbDataAdapter1
= new
System.Data.OleDb.OleDbDataAdapter();
this.oleDbInsertCommand1
= new
System.Data.OleDb.OleDbCommand();
this.oleDbConnection1
= new
System.Data.OleDb.OleDbConnection();
this.oleDbSelectCommand1
= new
System.Data.OleDb.OleDbCommand();
this.objAboutdset
= new
App_VCSNet.Aboutdset();
this.Label7
= new
System.Windows.Forms.Label();
this.label1
= new
System.Windows.Forms.Label();
this.groupBox1
= new
System.Windows.Forms.GroupBox();
this.btnbiography
= new
System.Windows.Forms.Button();
this.pictureBox1
= new
System.Windows.Forms.PictureBox();
this.btnDone
= new
System.Windows.Forms.Button();
this.editTextData
= new
System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)( this.objAboutdset)).BeginInit();
this.SuspendLayout();
//
//
oleDbDataAdapter1
//
this.oleDbDataAdapter1.InsertCommand
= this.oleDbInsertCommand1;
this.oleDbDataAdapter1.SelectCommand
= this.oleDbSelectCommand1;
this.oleDbDataAdapter1.TableMappings.AddRange(new
System.Data.Common.DataTableMapping[] {
new
System.Data.Common.DataTableMapping("Table", "BibleTable",
new
System.Data.Common.DataColumnMapping[] {
new
System.Data.Common.DataColumnMapping("Book", "Book"),
new
System.Data.Common.DataColumnMapping("BookTitle", "BookTitle"),
new
System.Data.Common.DataColumnMapping("Chapter", "Chapter"),
new
System.Data.Common.DataColumnMapping("TextData", "TextData"),
new
System.Data.Common.DataColumnMapping("Verse", "Verse")})});
//
//
oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText
= "INSERT INTO BibleTable(Book, BookTitle, Chapter, TextData,
Verse) VALUES (?, ?, ?" +
", ?, ?)";
this.oleDbInsertCommand1.Connection
= this.oleDbConnection1;
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Book",
System.Data.OleDb.OleDbType.VarWChar, 50, "Book"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("BookTitle",
System.Data.OleDb.OleDbType.VarWChar, 50, "BookTitle"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Chapter",
System.Data.OleDb.OleDbType.VarWChar, 50, "Chapter"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("TextData",
System.Data.OleDb.OleDbType.VarWChar, 0, "TextData"));
this.oleDbInsertCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("Verse",
System.Data.OleDb.OleDbType.VarWChar, 50, "Verse"));
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString
= @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database Locking Mode=1;Data Source=""C:\App_VCSNet\pic\KJV2002.mdb"";Jet
OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet
OLEDB:System database=;Jet OLEDB:SFP=False;persist security
info=False;Extended Properties=;Mode=Share Deny None;Jet
OLEDB:Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet
OLEDB:Global Bulk Transactions=1";
//
//
oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText
= "SELECT Book, BookTitle, Chapter, TextData, Verse FROM
BibleTable";
this.oleDbSelectCommand1.Connection
= this.oleDbConnection1;
//
// objAboutdset
//
this.objAboutdset.DataSetName
= "Aboutdset";
this.objAboutdset.Locale
= new
System.Globalization.CultureInfo("en-US");
//
// Label7
//
this.Label7.Font
= new
System.Drawing.Font("Microsoft Sans Serif", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold
| System.Drawing.FontStyle.Italic))),
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label7.Location
= new
System.Drawing.Point(88, 120);
this.Label7.Name
= "Label7";
this.Label7.Size
= new
System.Drawing.Size(168, 16);
this.Label7.TabIndex
= 29;
this.Label7.Text
= "develoled with Visual C# .Net";
//
// label1
//
this.label1.Font
= new
System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold
| System.Drawing.FontStyle.Italic))),
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location
= new
System.Drawing.Point(80, 0);
this.label1.Name
= "label1";
this.label1.Size
= new
System.Drawing.Size(176, 16);
this.label1.TabIndex
= 28;
this.label1.Text
= "KJV2002 database info";
//
// groupBox1
//
this.groupBox1.BackColor
= System.Drawing.SystemColors.ControlText;
this.groupBox1.Location
= new
System.Drawing.Point(80, 136);
this.groupBox1.Name
= "groupBox1";
this.groupBox1.Size
= new
System.Drawing.Size(272, 2);
this.groupBox1.TabIndex
= 27;
this.groupBox1.TabStop
= false;
//
// btnbiography
//
this.btnbiography.Location
= new
System.Drawing.Point(128, 144);
this.btnbiography.Name
= "btnbiography";
this.btnbiography.TabIndex
= 26;
this.btnbiography.Text
= "Biography";
this.btnbiography.Click
+= new
System.EventHandler(this.btnbiography_Click);
//
// pictureBox1
//
this.pictureBox1.Image
= ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location
= new
System.Drawing.Point(8, 8);
this.pictureBox1.Name
= "pictureBox1";
this.pictureBox1.Size
= new
System.Drawing.Size(62, 145);
this.pictureBox1.SizeMode
= System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex
= 25;
this.pictureBox1.TabStop
= false;
//
// btnDone
//
this.btnDone.Font
= new
System.Drawing.Font("Times New Roman", 9.75F,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.btnDone.Location
= new
System.Drawing.Point(248, 144);
this.btnDone.Name
= "btnDone";
this.btnDone.TabIndex
= 23;
this.btnDone.Text
= "Done";
this.btnDone.Click
+= new
System.EventHandler(this.btnDone_Click);
//
// editTextData
//
this.editTextData.BackColor
= System.Drawing.SystemColors.Control;
this.editTextData.BorderStyle
= System.Windows.Forms.BorderStyle.None;
this.editTextData.DataBindings.Add(new
System.Windows.Forms.Binding("Text",
this.objAboutdset,
"BibleTable.TextData"));
this.editTextData.Location
= new
System.Drawing.Point(80, 24);
this.editTextData.Multiline
= true;
this.editTextData.Name
= "editTextData";
this.editTextData.Size
= new
System.Drawing.Size(288, 96);
this.editTextData.TabIndex
= 24;
this.editTextData.Text
= "";
//
// About
//
this.AutoScaleBaseSize
= new
System.Drawing.Size(5, 13);
this.ClientSize
= new
System.Drawing.Size(378, 170);
this.Controls.Add(this.Label7);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnbiography);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.btnDone);
this.Controls.Add(this.editTextData);
this.FormBorderStyle
= System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name
= "About";
this.StartPosition
= System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text
= "About";
this.Load
+= new
System.EventHandler(this.About_Load);
((System.ComponentModel.ISupportInitialize)( this.objAboutdset)).EndInit();
this.ResumeLayout(false);
}
#endregion
private
void
About_Load(object
sender, System.EventArgs e)
{
try
{
// Attempt to load
the dataset.
this.LoadDataSet();
}
catch
(System.Exception eLoad)
{
// Add your error
handling code here.
// Display error
message, if any.
System.Windows.Forms.MessageBox.Show(eLoad.Message);
}
// StatusBar
Panel N1 = Message
fm.Show();
fm.statusBarPanel1.Text =
"Ready...";
fm.Refresh();
}
public
void
LoadDataSet()
{
// Create a new
dataset to hold the records returned from the call to
FillDataSet.
// A temporary
dataset is used because filling the existing dataset would
// require the
databindings to be rebound.
App_VCSNet.Aboutdset objDataSetTemp;
objDataSetTemp =
new App_VCSNet.Aboutdset();
try
{
// Attempt to fill
the temporary dataset.
this.FillDataSet(objDataSetTemp);
}
catch
(System.Exception eFillDataSet)
{
// Add your error
handling code here.
throw
eFillDataSet;
}
try
{
// Empty the old
records from the dataset.
objAboutdset.Clear();
// Merge the
records into the main dataset.
objAboutdset.Merge(objDataSetTemp);
}
catch
(System.Exception eLoadMerge)
{
// Add your error
handling code here.
throw
eLoadMerge;
}
}
public
void
FillDataSet(App_VCSNet.Aboutdset dataSet)
{
// Turn off
constraint checking before the dataset is filled.
// This allows the
adapters to fill the dataset without concern
// for dependencies
between the tables.
dataSet.EnforceConstraints =
false;
try
{
// Open the
connection.
this.oleDbConnection1.Open();
// Attempt to fill
the dataset through the OleDbDataAdapter1.
this.oleDbDataAdapter1.Fill(dataSet);
}
catch
(System.Exception fillException)
{
// Add your error
handling code here.
throw
fillException;
}
finally
{
// Turn constraint
checking back on.
dataSet.EnforceConstraints =
true;
// Close the
connection whether or not the exception was thrown.
this.oleDbConnection1.Close();
}
}
private
void
btnbiography_Click(object
sender, System.EventArgs e)
{
Biography FBio =
new
Biography();
// StatusBar Panel N1 = Message
fm.Show();
fm.statusBarPanel1.Text =
"Biography Form, moment ...";
fm.Refresh();
// display
Biography dialog
FBio.Show();
}
private
void
btnDone_Click(object
sender, System.EventArgs e)
{
this.Close();
}
}
} |
|
|
|
|