|
The Form design,
About.vjs
Create Visual Basic .Net Forn - About.jsl
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-VJSNet, select Add
on the shortcut menu to open other shortcut menu, click
Add New Item, the Add New Item - App-VJSNet dialog
box appears.
- In the Add New
Item -App-VJSNet 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-VJSNet\Pic\KJV2002.mdb.
- A data
adapter .
- A typed
dataset to hold the records fetched from the
database
|
- In the Name
box, type About.jsl
- 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-VJSNet\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
...
package
App_VJSNet; import
System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
/**
* Summary description for About.
*/
public
class
About extends
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_VJSNet.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;
/**
* Required designer variable.
*/
private
System.ComponentModel.Container components =
null;
public
About()
{
//
// Required for
Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any
constructor code after InitializeComponent call
//
}
/**
* Clean up any resources being used.
*/
protected
void
Dispose(boolean
disposing)
{
if
(disposing)
{
if
(components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
#region Windows Form Designer
generated code
/**
* Required method for Designer support - do not modify
* the contents of this method with the code editor.
*/
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_VJSNet.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.set_CommandText("SELECT
Book, BookTitle, Chapter, TextData, Verse FROM BibleTable");
this.oleDbSelectCommand1.set_Connection(this.oleDbConnection1);
//
//
oleDbInsertCommand1
//
this.oleDbInsertCommand1.set_CommandText("INSERT
INTO BibleTable(Book, BookTitle, Chapter, TextData, Verse)
VALUES (?, ?, ?" +
", ?, ?)");
this.oleDbInsertCommand1.set_Connection(this.oleDbConnection1);
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("Book",
System.Data.OleDb.OleDbType.VarWChar, 50, "Book"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("BookTitle",
System.Data.OleDb.OleDbType.VarWChar, 50, "BookTitle"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("Chapter",
System.Data.OleDb.OleDbType.VarWChar, 50, "Chapter"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("TextData",
System.Data.OleDb.OleDbType.VarWChar, 0, "TextData"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("Verse",
System.Data.OleDb.OleDbType.VarWChar, 50, "Verse"));
//
//
oleDbConnection1
//
this.oleDbConnection1.set_ConnectionString("Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database L" +
"ocking Mode=1;Data Source=\"C:\\App_VJSNet\\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 Dat" +
"abase=False;Jet OLEDB:Don\'t Copy Locale on Compact=False;Jet
OLEDB:Compact Witho" +
"ut Replica Repair=False;User ID=Admin;Jet
OLEDB:Encrypt Database=False");
//
//
oleDbDataAdapter1
//
this.oleDbDataAdapter1.set_InsertCommand(this.oleDbInsertCommand1);
this.oleDbDataAdapter1.set_SelectCommand(this.oleDbSelectCommand1);
this.oleDbDataAdapter1.get_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.set_DataSetName("Aboutdset");
this.objAboutdset.set_Locale(new
System.Globalization.CultureInfo("en-US"));
//
// btnLoad
//
this.btnLoad.set_Location(new
System.Drawing.Point(10, 10));
this.btnLoad.set_Name("btnLoad");
this.btnLoad.set_TabIndex(0);
this.btnLoad.set_Text("&Load");
this.btnLoad.add_Click(
new
System.EventHandler(this.btnLoad_Click)
);
//
// btnUpdate
//
this.btnUpdate.set_Location(new
System.Drawing.Point(145, 10));
this.btnUpdate.set_Name("btnUpdate");
this.btnUpdate.set_TabIndex(1);
this.btnUpdate.set_Text("&Update");
this.btnUpdate.add_Click(
new
System.EventHandler(this.btnUpdate_Click)
);
//
// lblTextData
//
this.lblTextData.set_Location(new
System.Drawing.Point(10, 43));
this.lblTextData.set_Name("lblTextData");
this.lblTextData.set_TabIndex(2);
this.lblTextData.set_Text("TextData");
//
// editTextData
//
this.editTextData.get_DataBindings().Add(new
System.Windows.Forms.Binding("Text",
this.objAboutdset,
"BibleTable.TextData"));
this.editTextData.set_Location(new
System.Drawing.Point(120, 43));
this.editTextData.set_Name("editTextData");
this.editTextData.set_TabIndex(3);
this.editTextData.set_Text("");
//
// About
//
this.set_AutoScaleBaseSize(new
System.Drawing.Size(5, 13));
this.set_ClientSize(new
System.Drawing.Size(360, 85));
this.get_Controls().Add(this.btnLoad);
this.get_Controls().Add(this.btnUpdate);
this.get_Controls().Add(this.lblTextData);
this.get_Controls().Add(this.editTextData);
this.set_Name("About");
this.set_Text("About");
((System.ComponentModel.ISupportInitialize)( this.objAboutdset)).EndInit();
this.ResumeLayout(false);
}
#endregion
public
void
FillDataSet (App_VJSNet.Aboutdset dataSet)
throws
System.Exception
{
// 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.set_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.set_EnforceConstraints( true);
// Close the
connection whether or not the exception was thrown.
this.oleDbConnection1.Close();
}
}
public
void
UpdateDataSource (App_VJSNet.Aboutdset ChangedRows)
throws
System.Exception
{
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 ()
throws System.Exception
{
// 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_VJSNet.Aboutdset objDataSetTemp;
objDataSetTemp =
new App_VJSNet.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 ()
throws System.Exception
{
// Create a new
dataset to hold the changes that have been made to the
main dataset.
App_VJSNet.Aboutdset objDataSetChanges =
new
App_VJSNet.Aboutdset();
// Stop any
current edits.
this.get_BindingContext().get_Item(objAboutdset,"BibleTable").EndCurrentEdit();
// Get the
changes that have been made to the main dataset.
objDataSetChanges = ((App_VJSNet.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.get_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.get_Message());
}
}
} | | |
- From the CD-Rom -
Teach_VNet, copy the bmp file
diam1.bmp
(\\App-VJSNet\Pic\diam1.bmp)
to the folder-
c:\App-VJSNet\Pic
- On the Projet
menu , click Add Existing Item ..., Add
Existing Item - App-VJSBNet dialog box appears, select the
files diam1.bmp
of the folder c:\App-VJSNet\Pic, and then
click Open.
|
1. |
The About.jsl design |
|
 |
The Properties of the
Form - About.jsl... |
|
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-VJSNet\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-VJSNet\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 J# .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.jsl 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
|
|
package
App_VJSNet; import
System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import App_VJSNet.*;
/**
* Summary description for About.
*/
public
class
About extends
System.Windows.Forms.Form
{
private
System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
private
App_VJSNet.Aboutdset objAboutdset;
private
System.Windows.Forms.TextBox editTextData1;
private
System.Windows.Forms.Button btnbiography;
private
System.Windows.Forms.Button btnDone;
private
System.Windows.Forms.GroupBox groupBox1;
private
System.Windows.Forms.PictureBox pictureBox1;
private
System.Windows.Forms.Label label1;
private
System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private
System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private
System.Data.OleDb.OleDbConnection oleDbConnection1;
System.Windows.Forms.Label Label2;
private
System.ComponentModel.Container components =
null;
/**
* Required designer variable.
*/
MainForm fm = new MainForm();
public
About()
{
//
// Required for
Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any
constructor code after InitializeComponent call
//
}
/**
* Clean up any resources being used.
*/
protected
void
Dispose(boolean
disposing)
{
if
(disposing)
{
if
(components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
#region Windows Form Designer
generated code
/**
* Required method for Designer support - do not modify
* the contents of this method with the code editor.
*/
private
void
InitializeComponent()
{
System.Resources.ResourceManager resources =
new
System.Resources.ResourceManager(About.class.ToType());
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_VJSNet.Aboutdset();
this.editTextData1
= new
System.Windows.Forms.TextBox();
this.btnbiography
= new
System.Windows.Forms.Button();
this.btnDone
= new
System.Windows.Forms.Button();
this.groupBox1
= new
System.Windows.Forms.GroupBox();
this.pictureBox1
= new
System.Windows.Forms.PictureBox();
this.Label2
= new
System.Windows.Forms.Label();
this.label1
= new
System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)( this.objAboutdset)).BeginInit();
this.SuspendLayout();
//
//
oleDbDataAdapter1
//
this.oleDbDataAdapter1.set_InsertCommand(this.oleDbInsertCommand1);
this.oleDbDataAdapter1.set_SelectCommand(this.oleDbSelectCommand1);
this.oleDbDataAdapter1.get_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.set_CommandText("INSERT
INTO BibleTable(Book, BookTitle, Chapter, TextData, Verse)
VALUES (?, ?, ?" +
", ?, ?)");
this.oleDbInsertCommand1.set_Connection(this.oleDbConnection1);
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("Book",
System.Data.OleDb.OleDbType.VarWChar, 50, "Book"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("BookTitle",
System.Data.OleDb.OleDbType.VarWChar, 50, "BookTitle"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("Chapter",
System.Data.OleDb.OleDbType.VarWChar, 50, "Chapter"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("TextData",
System.Data.OleDb.OleDbType.VarWChar, 0, "TextData"));
this.oleDbInsertCommand1.get_Parameters().Add(new
System.Data.OleDb.OleDbParameter("Verse",
System.Data.OleDb.OleDbType.VarWChar, 50, "Verse"));
//
//
oleDbConnection1
//
this.oleDbConnection1.set_ConnectionString("Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database L" +
"ocking Mode=1;Data Source=\"C:\\z_CD_ROM\\C_Col_VJSNet\\App_VJSNet\\pic\\KJV2002.mdb\";"
+
"Jet OLEDB:Engine
Type=5;Provider=\"Microsoft.Jet.OLEDB.4.0\";Jet
OLEDB:System data" +
"base=;Jet OLEDB:SFP=False;persist security info=False;Extended
Properties=;Mode=" +
"Share Deny None;Jet OLEDB:Encrypt Database=False;Jet
OLEDB:Create System Databas" +
"e=False;Jet OLEDB:Don\'t Copy Locale on Compact=False;Jet
OLEDB:Compact Without R" +
"eplica Repair=False;User ID=Admin;Jet OLEDB:Global
Bulk Transactions=1");
//
//
oleDbSelectCommand1
//
this.oleDbSelectCommand1.set_CommandText("SELECT
Book, BookTitle, Chapter, TextData, Verse FROM BibleTable");
this.oleDbSelectCommand1.set_Connection(this.oleDbConnection1);
//
// objAboutdset
//
this.objAboutdset.set_DataSetName("Aboutdset");
this.objAboutdset.set_Locale(new
System.Globalization.CultureInfo("en-US"));
//
// editTextData1
//
this.editTextData1.set_BackColor(System.Drawing.SystemColors.get_Control());
this.editTextData1.set_BorderStyle(System.Windows.Forms.BorderStyle.None);
this.editTextData1.get_DataBindings().Add(new
System.Windows.Forms.Binding("Text",
this.objAboutdset,
"BibleTable.TextData"));
this.editTextData1.set_Location(new
System.Drawing.Point(88, 40));
this.editTextData1.set_Multiline(true);
this.editTextData1.set_Name("editTextData1");
this.editTextData1.set_Size(new
System.Drawing.Size(280, 96));
this.editTextData1.set_TabIndex(4);
this.editTextData1.set_Text("");
//
// btnbiography
//
this.btnbiography.set_Location(new
System.Drawing.Point(200, 168));
this.btnbiography.set_Name("btnbiography");
this.btnbiography.set_TabIndex(0);
this.btnbiography.set_Text("Biography");
this.btnbiography.add_Click(
new
System.EventHandler(this.btnbiography_Click)
);
//
// btnDone
//
this.btnDone.set_Font(new
System.Drawing.Font("Times New Roman", 9.75F,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((ubyte)(System.Byte)(((ubyte)0)))));
this.btnDone.set_Location(new
System.Drawing.Point(288, 168));
this.btnDone.set_Name("btnDone");
this.btnDone.set_TabIndex(1);
this.btnDone.set_Text("Done");
this.btnDone.add_Click(
new
System.EventHandler(this.btnDone_Click)
);
//
// groupBox1
//
this.groupBox1.set_BackColor(System.Drawing.SystemColors.get_ControlText());
this.groupBox1.set_Location(new
System.Drawing.Point(88, 160));
this.groupBox1.set_Name("groupBox1");
this.groupBox1.set_Size(new
System.Drawing.Size(280, 2));
this.groupBox1.set_TabIndex(3);
this.groupBox1.set_TabStop(false);
//
// pictureBox1
//
this.pictureBox1.set_Image(((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))));
this.pictureBox1.set_Location(new
System.Drawing.Point(16, 16));
this.pictureBox1.set_Name("pictureBox1");
this.pictureBox1.set_Size(new
System.Drawing.Size(62, 145));
this.pictureBox1.set_SizeMode(System.Windows.Forms.PictureBoxSizeMode.AutoSize);
this.pictureBox1.set_TabIndex(25);
this.pictureBox1.set_TabStop(false);
//
// Label2
//
this.Label2.set_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, ((ubyte)(System.Byte)(((ubyte)0)))));
this.Label2.set_Location(new
System.Drawing.Point(96, 144));
this.Label2.set_Name("Label2");
this.Label2.set_Size(new
System.Drawing.Size(168, 16));
this.Label2.set_TabIndex(2);
this.Label2.set_Text("developed
with Visual J# .Net");
//
// label1
//
this.label1.set_Font(new
System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold
| System.Drawing.FontStyle.Italic))),
System.Drawing.GraphicsUnit.Point, ((ubyte)(System.Byte)(((ubyte)0)))));
this.label1.set_Location(new
System.Drawing.Point(104, 8));
this.label1.set_Name("label1");
this.label1.set_Size(new
System.Drawing.Size(176, 16));
this.label1.set_TabIndex(5);
this.label1.set_Text("KJV2002
database info");
//
// About
//
this.set_AutoScaleBaseSize(new
System.Drawing.Size(5, 13));
this.set_ClientSize(new
System.Drawing.Size(378, 194));
this.get_Controls().Add(this.btnbiography);
this.get_Controls().Add(this.btnDone);
this.get_Controls().Add(this.groupBox1);
this.get_Controls().Add(this.pictureBox1);
this.get_Controls().Add(this.Label2);
this.get_Controls().Add(this.label1);
this.get_Controls().Add(this.editTextData1);
this.set_FormBorderStyle(System.Windows.Forms.FormBorderStyle.FixedToolWindow);
this.set_Name("About");
this.set_StartPosition(System.Windows.Forms.FormStartPosition.CenterScreen);
this.set_Text("About");
this.add_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.get_Message());
}
// StatusBar
Panel N1 = Message
fm.Show();
fm.statusBarPanel1.set_Text("Ready...
");
fm.Refresh();
}
public
void
LoadDataSet ()
throws System.Exception
{
// 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_VJSNet.Aboutdset objDataSetTemp;
objDataSetTemp =
new App_VJSNet.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_VJSNet.Aboutdset dataSet)
throws
System.Exception
{
// 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.set_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.set_EnforceConstraints( true);
// Close the
connection whether or not the exception was thrown.
this.oleDbConnection1.Close();
}
}
private
void
btnDone_Click (Object sender, System.EventArgs e)
{
this.Close();
}
private
void
btnbiography_Click (Object sender, System.EventArgs e)
{
Biography fbiog =
new
Biography();
// StatusBar
Panel N1 = Message
fm.Show();
fm.statusBarPanel1.set_Text("Biography Form, moment ...
");
fm.Refresh();
fbiog.Show();
}
} | | |
|
|