|
The Form design, Book.vb
1st TabPage selected of TabControl control..
|
2nd TabPage selected of TabControl control..
|
 |
 |
Create Visual Basic .Net Forn - Book.vb
Classes used in this Form:
OleDbConnection, OleDbDataAdapter,
OleDbCommand,
DataSet, PictureBox, Label, TextBox, Button,
TabControl, ListView, ComboBox
1- Add The Access file -
KJV2002.mdb
- From the CD-Rom -
Teach_VNet, copy the
DataBase file
KJV2002.mdb (\\APP-VBNet\Pic\KJV2002.mdb ) to
the
folder -
c:\APP-VBNet\Pic
- On the Projet
menu , click Add Existing Item ..., Add
Existing Item - APP-VBNet dialog box appears, select the
file KJV2002.mdb of the folder c:\APP-VBNet\Pic,
and then click Open.
2- Create
the Form book.vb
- On the View menu ,
click Solution Explorer
- In Solution Explorer,
right click the APP-VBNet, select Add on the shortcut
menu to open other shortcut menu, click Add New Item, the Add
New Item - APP-VBNet dialog box appears.
- In the Add New Item -APP-VBNet
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-VBNet\Pic\KJV2002.mdb.
- A data adapter .
- A typed dataset to hold the records fetched
from the database
|
- In the Name
box, type Book.vb
- 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 BKJV2002dset 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-VBNet\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 all Checkbox es (all Fields items
Book, BookTitle, Chapter, Verse and TextData ) and
then click Next
- In the 6th page,
select the Single record in individual controls radio button,
check only the Navigation controls check box 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 ...
Public
Class
BookInherits
System.Windows.Forms.Form
# Region
" Windows Form Designer generated code "
Public
Sub
New()
MyBase.New()
'This call is
required by the Windows Form Designer.
InitializeComponent()
'Add any
initialization after the InitializeComponent() call
End
Sub
'Form overrides
dispose to clean up the component list.
Protected
Overloads
Overrides
Sub
Dispose(ByVal
disposing As
Boolean)
If
disposing Then
If
Not
(components Is
Nothing)
Then
components.Dispose()
End
If
End
If
MyBase.Dispose(disposing)
End
Sub
'Required by the
Windows Form Designer
Private
components As
System.ComponentModel.IContainer
'NOTE: The
following procedure is required by the Windows Form Designer
'It can be modified
using the Windows Form Designer.
'Do not modify it
using the code editor.
Friend
WithEvents
OleDbSelectCommand1 As
System.Data.OleDb.OleDbCommand
Friend
WithEvents
OleDbInsertCommand1 As
System.Data.OleDb.OleDbCommand
Friend
WithEvents
OleDbConnection1 As
System.Data.OleDb.OleDbConnection
Friend
WithEvents
OleDbDataAdapter1 As
System.Data.OleDb.OleDbDataAdapter
Friend
WithEvents
objBKJV2002dset As
WindowsApplication2.BKJV2002dset
Friend
WithEvents
btnLoad As
System.Windows.Forms.Button
Friend
WithEvents
btnUpdate As
System.Windows.Forms.Button
Friend
WithEvents
lblBook As
System.Windows.Forms.Label
Friend
WithEvents
lblBookTitle As
System.Windows.Forms.Label
Friend
WithEvents
lblChapter As
System.Windows.Forms.Label
Friend
WithEvents
editBook As
System.Windows.Forms.TextBox
Friend
WithEvents
editBookTitle As
System.Windows.Forms.TextBox
Friend
WithEvents
editChapter As
System.Windows.Forms.TextBox
Friend
WithEvents
lblTextData As
System.Windows.Forms.Label
Friend
WithEvents
lblVerse As
System.Windows.Forms.Label
Friend
WithEvents
editTextData As
System.Windows.Forms.TextBox
Friend
WithEvents
editVerse As
System.Windows.Forms.TextBox
Friend
WithEvents
btnNavFirst As
System.Windows.Forms.Button
Friend
WithEvents
btnNavPrev As
System.Windows.Forms.Button
Friend
WithEvents
lblNavLocation As
System.Windows.Forms.Label
Friend
WithEvents
btnNavNext As
System.Windows.Forms.Button
Friend
WithEvents
btnLast As
System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()>
Private
Sub
InitializeComponent()
Me.OleDbSelectCommand1
= New
System.Data.OleDb.OleDbCommand
Me.OleDbInsertCommand1
= New
System.Data.OleDb.OleDbCommand
Me.OleDbConnection1
= New
System.Data.OleDb.OleDbConnection
Me.OleDbDataAdapter1
= New
System.Data.OleDb.OleDbDataAdapter
Me.objBKJV2002dset
= New
WindowsApplication2.BKJV2002dset
Me.btnLoad
= New
System.Windows.Forms.Button
Me.btnUpdate
= New
System.Windows.Forms.Button
Me.lblBook
= New
System.Windows.Forms.Label
Me.lblBookTitle
= New
System.Windows.Forms.Label
Me.lblChapter
= New
System.Windows.Forms.Label
Me.editBook
= New
System.Windows.Forms.TextBox
Me.editBookTitle
= New
System.Windows.Forms.TextBox
Me.editChapter
= New
System.Windows.Forms.TextBox
Me.lblTextData
= New
System.Windows.Forms.Label
Me.lblVerse
= New
System.Windows.Forms.Label
Me.editTextData
= New
System.Windows.Forms.TextBox
Me.editVerse
= New
System.Windows.Forms.TextBox
Me.btnNavFirst
= New
System.Windows.Forms.Button
Me.btnNavPrev
= New
System.Windows.Forms.Button
Me.lblNavLocation
= New
System.Windows.Forms.Label
Me.btnNavNext
= New
System.Windows.Forms.Button
Me.btnLast
= New
System.Windows.Forms.Button
CType(Me.objBKJV2002dset,
System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText
= "SELECT Book, BookTitle, Chapter, TextData, Verse FROM
BibleTable"
Me.OleDbSelectCommand1.Connection
= Me.OleDbConnection1
'
'OleDbInsertCommand1
'
Me.OleDbInsertCommand1.CommandText
= "INSERT INTO BibleTable(Book, BookTitle, Chapter, TextData,
Verse) VALUES (?, ?, ?" & _
", ?, ?)"
Me.OleDbInsertCommand1.Connection
= Me.OleDbConnection1
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Book",
System.Data.OleDb.OleDbType.VarWChar, 50, "Book"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("BookTitle",
System.Data.OleDb.OleDbType.VarWChar, 50, "BookTitle"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Chapter",
System.Data.OleDb.OleDbType.VarWChar, 50, "Chapter"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("TextData",
System.Data.OleDb.OleDbType.VarWChar, 0, "TextData"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Verse",
System.Data.OleDb.OleDbType.VarWChar, 50, "Verse"))
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString
= "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry
Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""C:\APP-VBNet\Pic\KJV2002.mdb"";Je"
& _
"t OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Microsoft.J" & _
"et.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist
security in" & _
"fo=False;Extended Properties=;Mode=Share Deny None;Jet
OLEDB:Create System Datab" & _
"ase=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
'
Me.OleDbDataAdapter1.InsertCommand
= Me.OleDbInsertCommand1
Me.OleDbDataAdapter1.SelectCommand
= Me.OleDbSelectCommand1
Me.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")})})
'
'objBKJV2002dset
'
Me.objBKJV2002dset.DataSetName
= "BKJV2002dset"
Me.objBKJV2002dset.Locale
= New
System.Globalization.CultureInfo("en-US")
'
'btnLoad
'
Me.btnLoad.Location
= New
System.Drawing.Point(10, 10)
Me.btnLoad.Name
= "btnLoad"
Me.btnLoad.TabIndex
= 0
Me.btnLoad.Text
= "&Load"
'
'btnUpdate
'
Me.btnUpdate.Location
= New
System.Drawing.Point(365, 10)
Me.btnUpdate.Name
= "btnUpdate"
Me.btnUpdate.TabIndex
= 1
Me.btnUpdate.Text
= "&Update"
'
'lblBook
'
Me.lblBook.Location
= New
System.Drawing.Point(10, 43)
Me.lblBook.Name
= "lblBook"
Me.lblBook.TabIndex
= 2
Me.lblBook.Text
= "Book"
'
'lblBookTitle
'
Me.lblBookTitle.Location
= New
System.Drawing.Point(10, 76)
Me.lblBookTitle.Name
= "lblBookTitle"
Me.lblBookTitle.TabIndex
= 3
Me.lblBookTitle.Text
= "BookTitle"
'
'lblChapter
'
Me.lblChapter.Location
= New
System.Drawing.Point(10, 109)
Me.lblChapter.Name
= "lblChapter"
Me.lblChapter.TabIndex
= 4
Me.lblChapter.Text
= "Chapter"
'
'editBook
'
Me.editBook.DataBindings.Add(New
System.Windows.Forms.Binding("Text",
Me.objBKJV2002dset,
"BibleTable.Book"))
Me.editBook.Location
= New
System.Drawing.Point(120, 43)
Me.editBook.Name
= "editBook"
Me.editBook.TabIndex
= 5
Me.editBook.Text
= ""
'
'editBookTitle
'
Me.editBookTitle.DataBindings.Add(New
System.Windows.Forms.Binding("Text",
Me.objBKJV2002dset,
"BibleTable.BookTitle"))
Me.editBookTitle.Location
= New
System.Drawing.Point(120, 76)
Me.editBookTitle.Name
= "editBookTitle"
Me.editBookTitle.TabIndex
= 6
Me.editBookTitle.Text
= ""
'
'editChapter
'
Me.editChapter.DataBindings.Add(New
System.Windows.Forms.Binding("Text",
Me.objBKJV2002dset,
"BibleTable.Chapter"))
Me.editChapter.Location
= New
System.Drawing.Point(120, 109)
Me.editChapter.Name
= "editChapter"
Me.editChapter.TabIndex
= 7
Me.editChapter.Text
= ""
'
'lblTextData
'
Me.lblTextData.Location
= New
System.Drawing.Point(230, 43)
Me.lblTextData.Name
= "lblTextData"
Me.lblTextData.TabIndex
= 8
Me.lblTextData.Text
= "TextData"
'
'lblVerse
'
Me.lblVerse.Location
= New
System.Drawing.Point(230, 76)
Me.lblVerse.Name
= "lblVerse"
Me.lblVerse.TabIndex
= 9
Me.lblVerse.Text
= "Verse"
'
'editTextData
'
Me.editTextData.DataBindings.Add(New
System.Windows.Forms.Binding("Text",
Me.objBKJV2002dset,
"BibleTable.TextData"))
Me.editTextData.Location
= New
System.Drawing.Point(340, 43)
Me.editTextData.Name
= "editTextData"
Me.editTextData.TabIndex
= 10
Me.editTextData.Text
= ""
'
'editVerse
'
Me.editVerse.DataBindings.Add(New
System.Windows.Forms.Binding("Text",
Me.objBKJV2002dset,
"BibleTable.Verse"))
Me.editVerse.Location
= New
System.Drawing.Point(340, 76)
Me.editVerse.Name
= "editVerse"
Me.editVerse.TabIndex
= 11
Me.editVerse.Text
= ""
'
'btnNavFirst
'
Me.btnNavFirst.Location
= New
System.Drawing.Point(195, 142)
Me.btnNavFirst.Name
= "btnNavFirst"
Me.btnNavFirst.Size
= New
System.Drawing.Size(40, 23)
Me.btnNavFirst.TabIndex
= 12
Me.btnNavFirst.Text
= "<<"
'
'btnNavPrev
'
Me.btnNavPrev.Location
= New
System.Drawing.Point(235, 142)
Me.btnNavPrev.Name
= "btnNavPrev"
Me.btnNavPrev.Size
= New
System.Drawing.Size(35, 23)
Me.btnNavPrev.TabIndex
= 13
Me.btnNavPrev.Text
= "<"
'
'lblNavLocation
'
Me.lblNavLocation.BackColor
= System.Drawing.Color.White
Me.lblNavLocation.Location
= New
System.Drawing.Point(270, 142)
Me.lblNavLocation.Name
= "lblNavLocation"
Me.lblNavLocation.Size
= New
System.Drawing.Size(95, 23)
Me.lblNavLocation.TabIndex
= 14
Me.lblNavLocation.Text
= "No Records"
Me.lblNavLocation.TextAlign
= System.Drawing.ContentAlignment.MiddleCenter
'
'btnNavNext
'
Me.btnNavNext.Location
= New
System.Drawing.Point(365, 142)
Me.btnNavNext.Name
= "btnNavNext"
Me.btnNavNext.Size
= New
System.Drawing.Size(35, 23)
Me.btnNavNext.TabIndex
= 15
Me.btnNavNext.Text
= ">"
'
'btnLast
'
Me.btnLast.Location
= New
System.Drawing.Point(400, 142)
Me.btnLast.Name
= "btnLast"
Me.btnLast.Size
= New
System.Drawing.Size(40, 23)
Me.btnLast.TabIndex
= 16
Me.btnLast.Text
= ">>"
'
'Book
'
Me.AutoScaleBaseSize
= New
System.Drawing.Size(5, 13)
Me.ClientSize
= New
System.Drawing.Size(442, 181)
Me.Controls.Add(Me.btnLoad)
Me.Controls.Add(Me.btnUpdate)
Me.Controls.Add(Me.lblBook)
Me.Controls.Add(Me.lblBookTitle)
Me.Controls.Add(Me.lblChapter)
Me.Controls.Add(Me.editBook)
Me.Controls.Add(Me.editBookTitle)
Me.Controls.Add(Me.editChapter)
Me.Controls.Add(Me.lblTextData)
Me.Controls.Add(Me.lblVerse)
Me.Controls.Add(Me.editTextData)
Me.Controls.Add(Me.editVerse)
Me.Controls.Add(Me.btnNavFirst)
Me.Controls.Add(Me.btnNavPrev)
Me.Controls.Add(Me.lblNavLocation)
Me.Controls.Add(Me.btnNavNext)
Me.Controls.Add(Me.btnLast)
Me.Name
= "Book"
Me.Text
= "Book"
CType(Me.objBKJV2002dset,
System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End
Sub
# End
Region
Private
Sub
btnUpdate_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btnUpdate.Click
Try
'Attempt to update
the datasource.
Me.UpdateDataSet()
Catch
eUpdate As
System.Exception
'Add your error
handling code here.
'Display error
message, if any.
System.Windows.Forms.MessageBox.Show(eUpdate.Message)
End
Try
Me.objBKJV2002dset_PositionChanged()
End
Sub
Private
Sub
btnLoad_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btnLoad.Click
Try
'Attempt to load
the dataset.
Me.LoadDataSet()
Catch
eLoad As
System.Exception
'Add your error
handling code here.
'Display error
message, if any.
System.Windows.Forms.MessageBox.Show(eLoad.Message)
End
Try
Me.objBKJV2002dset_PositionChanged()
End
Sub
Private
Sub
btnNavFirst_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btnNavFirst.Click
Me.BindingContext(objBKJV2002dset,
"BibleTable").Position = 0
Me.objBKJV2002dset_PositionChanged()
End
Sub
Private
Sub
btnLast_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btnLast.Click
Me.BindingContext(objBKJV2002dset,
"BibleTable").Position = (Me.objBKJV2002dset.Tables("BibleTable").Rows.Count
- 1)
Me.objBKJV2002dset_PositionChanged()
End
Sub
Private
Sub
btnNavPrev_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btnNavPrev.Click
Me.BindingContext(objBKJV2002dset,
"BibleTable").Position = (Me.BindingContext(objBKJV2002dset,
"BibleTable").Position - 1)
Me.objBKJV2002dset_PositionChanged()
End
Sub
Private
Sub
btnNavNext_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs)
Handles btnNavNext.Click
Me.BindingContext(objBKJV2002dset,
"BibleTable").Position = (Me.BindingContext(objBKJV2002dset,
"BibleTable").Position + 1)
Me.objBKJV2002dset_PositionChanged()
End
Sub
Private
Sub
objBKJV2002dset_PositionChanged()
Me.lblNavLocation.Text
= (((Me.BindingContext(objBKJV2002dset,
"BibleTable").Position + 1).ToString + " of ") _
+ Me.BindingContext(objBKJV2002dset,
"BibleTable").Count.ToString)
End
Sub
Public
Sub
UpdateDataSet()
'Create a new
dataset to hold the changes that have been made to the main
dataset.
Dim
objDataSetChanges As
WindowsApplication2.BKJV2002dset =
New
WindowsApplication2.BKJV2002dset
'Stop any current
edits.
Me.BindingContext(objBKJV2002dset,
"BibleTable").EndCurrentEdit()
'Get the changes
that have been made to the main dataset.
objDataSetChanges =
CType(objBKJV2002dset.GetChanges,
WindowsApplication2.BKJV2002dset)
'Check to see if
any changes have been made.
If
(Not
(objDataSetChanges) Is
Nothing)
Then
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.
Me.UpdateDataSource(objDataSetChanges)
objBKJV2002dset.Merge(objDataSetChanges)
objBKJV2002dset.AcceptChanges()
Catch
eUpdate As
System.Exception
'Add your error
handling code here.
Throw
eUpdate
End
Try
'Add your code to
check the returned dataset for any errors that may have been
'pushed into the
row object's error.
End
If
End
Sub
Public
Sub
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.
Dim
objDataSetTemp As
WindowsApplication2.BKJV2002dset
objDataSetTemp =
New WindowsApplication2.BKJV2002dset
Try
'Attempt to fill
the temporary dataset.
Me.FillDataSet(objDataSetTemp)
Catch
eFillDataSet As
System.Exception
'Add your error
handling code here.
Throw
eFillDataSet
End
Try
Try
'Empty the old
records from the dataset.
objBKJV2002dset.Clear()
'Merge the records
into the main dataset.
objBKJV2002dset.Merge(objDataSetTemp)
Catch
eLoadMerge As
System.Exception
'Add your error
handling code here.
Throw
eLoadMerge
End
Try
End
Sub
Public
Sub
UpdateDataSource(ByVal
ChangedRows As
WindowsApplication2.BKJV2002dset)
Try
'The data source
only needs to be updated if there are changes pending.
If
(Not
(ChangedRows) Is
Nothing)
Then
'Open the
connection.
Me.OleDbConnection1.Open()
'Attempt to update
the data source.
OleDbDataAdapter1.Update(ChangedRows)
End
If
Catch
updateException As
System.Exception
'Add your error
handling code here.
Throw
updateException
Finally
'Close the
connection whether or not the exception was thrown.
Me.OleDbConnection1.Close()
End
Try
End
Sub
Public
Sub
FillDataSet(ByVal
dataSet As
WindowsApplication2.BKJV2002dset)
'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.
Me.OleDbConnection1.Open()
'Attempt to fill
the dataset through the OleDbDataAdapter1.
Me.OleDbDataAdapter1.Fill(dataSet)
Catch
fillException As
System.Exception
'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.
Me.OleDbConnection1.Close()
End
Try
End
Sub
End
Class |
|
|
- From the CD-Rom -
Teach_VNet, copy the files -
forum.bmp, Christus-th.bmp and butterfly1.bmp (include
in the Folder - \\APP-VBNet\Pic) to
the folder -
c:\APP-VBNet\Pic
- On the Projet
menu , click Add Existing Item ..., Add
Existing Item - APP-VBNet dialog box appears, select the
files forum.bmp, Christus-th.bmp and butterfly1.bmp of the folder c:\APP-VBNet\Pic,
and then click Open.
|
1- |
The
Properties of the Form - book.vb.
|
|
|
Old |
New |
Name:
Backcolor:
Icon:
Maximize:
Menu:
Size:
Start Position:
Text:
Window State: |
Book
Control
Icon
True
(none)
450,250
WindowsDefaultLocation
Book
Normal |
Book
InactiveCaption
Icon
false
(none)
688,489
CenterScreen
Book ...
Normal |
|
|
2- |
List of
controls created by the Data Form Wizard ...
One
OleDbConnection control, one OleDbDataAdapter control, one DataSet
control, six Label controls, fiveTextBox controls
and four Button
controls
|
|
-
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-VBNet\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 OleDbDataAdapter1 Properties:
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
(Collection)
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
objBKJV2002dset Properties:
Name:
DataSetName: |
objBKJV2002dset
BKJV2002dset |
|
-
The
TextBox control, created by ...
- EditBook Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.Book
EditBook
Window
Fixed3D
Microsoft Sons Serief, 8.25pt
False
False
100,20
|
|
-
The
TextBox control, created by ...
- EditBookTitle Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.BookTitle
EditBookTitle
Window
Fixed3D
Microsoft Sons Serief, 8.25pt
False
False
100,20
|
|
-
The
TextBox control, created by ...
- EditChapter Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset - BibleTable.Chapter
EditChapter
Window
Fixed3D
Microsoft Sons Serief, 8.25pt
False
False
100,20
|
|
-
The
TextBox control, created by ...
- EditVerse Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset - BibleTable.Verse
EditVerse
Window
Fixed3D
Microsoft Sons Serief, 8.25pt
False
False
100,20
|
|
-
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 ...
-
lblBook Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblBook
Control
Microsoft Sons Serief, 8.25pt
100,23
Book |
|
-
The
Label control, created by ...
-
lblBookTitle Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblBookTitle
Control
Microsoft Sons Serief, 8.25pt
100,23
BookTitle |
|
-
The
Label control, created by ...
-
lblChapter Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblChapter
Control
Microsoft Sons Serief, 8.25pt
100,23
Chapter |
|
-
The
Label control, created by ...
-
lblVerse Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblVerse
Control
Microsoft Sons Serief, 8.25pt
100,23
Verse |
|
-
The
Label control, created by ...
-
lblTextData Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblTextData
Control
Microsoft Sons Serief, 8.25pt
100,23
TextData |
|
-
The
Label control, created by ...
-
lblNavigation Properties:
Name:
BackColor:
Font:
Size:
Text:
TextAlign: |
lblNavigation
White
Microsoft Sons Serief, 8.25pt
95,23
No Records
MiddleCenter |
|
-
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 |
|
-
The Button control, created by ...
-
btnNavFirst Properties:
Name:
BackColor:
Size:
Text: |
btnNavFirst
Control
40,23
<< |
|
-
The Button control, created by ...
-
btnNavPrev Properties:
Name:
BackColor:
Size:
Text: |
btnNavPrev
Control
40,23
< |
|
-
The Button control, created by ...
-
btnNavNext Properties:
Name:
BackColor:
Size:
Text: |
btnNavNext
Control
40,23
> |
|
-
The Button control, created by ...
-
btnLast Properties:
Name:
BackColor:
Size:
Text: |
btnLast
Control
40,23
>> |
|
|
Remove the following controls created...:
one Label
control - lblTextData and two Button controls -
btnLoad and btnUpdate |
|
Modify the Properties of the
following controls created:
Five TextBox controls, Four Label controls and
four Button controls
|
-
Modify
the TextBox control,
EditBook
Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.Book
EditBook
Info
FixedSigle
Microsoft Sons Serief, 8.25pt
True
False
88,20
|
|
-
Modify
the TextBox control,
EditBookTitle
Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.BookTitle
EditBookTitle
Info
FixedSigle
Microsoft Sons Serief, 8.25pt
True
False
88,20
|
|
-
Modify
the TextBox control,
EditChapter
Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.Chapter
EditChapter
Info
FixedSigle
Microsoft Sons Serief, 8.25pt
True
False
88,20
|
|
-
Modify
the TextBox control,
EditVerse
Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.Verse
EditVerse
Info
FixedSigle
Microsoft Sons Serief, 8.25pt
True
False
88,20
|
|
-
Modify
the TextBox control,
EditTextData
Properties:
DataBindings
Text:
Name:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
objKJV2002dset -
BibleTable.TextData
EditTextData
Info
FixedSigle
Microsoft Sons Serief, 8.25pt
True
True
320,94
|
|
-
Modify
the
Label control, lblBook Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblBook
InactiveCaption
Times New Roman, 9pt
56,16
Book |
|
-
Modify
the
Label control, lblBookTitle Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblBookTitle
InactiveCaption
Times New Roman, 9pt
56,16
BookTitle |
|
-
Modify
the
Label control, lblChapter Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblChapter
InactiveCaption
Times New Roman, 9pt
56,16
Chapter |
|
-
Modify
the
Label control, lblVerse Properties:
Name:
BackColor:
Font:
Size:
Text: |
lblVerse
InactiveCaption
Times New Roman, 9pt
56,16
Verse |
|
-
Modify
the
Label control, lblNavigation Properties:
Name:
BackColor:
Font:
Size:
Text:
TextAlign: |
lblNavigation
White
Times New Roman, 8.25pt
80,23
No Records
MiddleCenter |
|
-
Modify
the
Button control, btnNavFirst
Properties:
Name:
BackColor:
Size:
Text: |
btnNavFirst
InactiveCaption
32,23
<< |
|
-
Modify
the
Button control, btnNavPrev
Properties:
Name:
BackColor:
Size:
Text: |
btnNavPrev
InactiveCaption
32,23
< |
|
-
Modify
the
Button control, btnNavNext
Properties:
Name:
BackColor:
Size:
Text: |
btnNavNext
InactiveCaption
32,23
> |
|
-
Modify
the
Button control, btnLast
Properties:
Name:
BackColor:
Size:
Text: |
btnLast
InactiveCaption
32,23
>> |
|
|
|
|
3- |
The Book.vb
design, Part1 |
|

|
4- |
From
the Toolbox/Windows Form
add the 1st List of controls ....
Two PictureBox control, tree Label
controls, two Button controls and one tabControl Control.
|
|
-
Add the PictureBox control
-
PictureBox1, PictureBox Properties:
Name:
Image:
Size Mode: |
PictureBox1
System.Drawing.Bitmap
Autosize |
|
Bitmap file added =
C:\App-VBNet\Pic\Chriistus-th.bmp
-
Add the PictureBox control
-
PictureBox2, PictureBox Properties:
Name:
Image:
Size Mode: |
PictureBox1
System.Drawing.Bitmap
Autosize |
|
Bitmap file added =
C:\App-VBNet\Pic\forum.bmp
-
Add the Label control
-
Label2, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label2
Times New Roman, 9.75pt, style=Bold, Italic
120,16
Record data boxes
TopLeft |
|
-
Add the Label control
-
Line1, Label Properties:
Name:
BackColor:
Font:
Size:
Text:
TextAlign: |
Line1
Desktop
Microsoft Sans Serif, 8.25pt
8,464
TopLeft |
|
-
Add the Button control
-
btnAbout, Button Properties:
Name:
BackColor:
Size:
Text: |
btnAbout
InactiveCaption
48,24
About |
|
-
Add the Button control
-
btnDone, Button Properties:
Name:
BackColor:
Size:
Text: |
btnDone
InactiveCaption
48,24
About |
|
-
Add the Label control
-
Label1, Label Properties:
Name:
BackColor:
Size:
Text: |
Label1
InactiveCaption
120,16
Search |
|
-
Add
the TabControl control - TabControl1,
TabControl Properties:
Name:
Size:
TabPages: |
TabControl1
312,184
(Collection) |
|
Add 2 pages to
this TabControl,
when you click Collection of TabPages
property, the TabPage Collection Editor
dialog box appears. In this Editor add 2 pages
Member |
BackColor |
Text |
Size |
TabPage1
TabPage2 |
Info
Info |
By word
By address |
304,158
304,158 |
|
|
|
5- |
The Book.vb
design, Part 2 |
|

|
6- |
From
the Toolbox/Windows Form
add the 2nd List of controls ....
Two Label
controls, one Textbox control, two Button controls, .one
ListView control and two ImageList controls.
|
|
-
Add the Label control
-
Label3, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label3
Times New Roman, 8.25pt
168,16
Type in the word to search for:
TopLeft |
|
-
Add the TextBox control
- TxtWord Properties:
Name:
Autosize:
BackColor:
BorderStyle:
Font:
Locked:
Multiline:
Size:
Text: |
TxtWord
False
Window
Fixed3D
Microsoft Sans Serief, 8.25pt
False
False
168,19
|
|
-
Add the Button control -
btnSearch Properties:
Name:
BackColor:
Enabled:
Size:
Text: |
btnSearch
Control
False
48,24
Search |
|
-
Add the Button control -
btnView Properties:
Name:
BackColor:
Enabled:
Size:
Text: |
btnView
Control
False
48,24
View |
|
-
Add the ImageList control -
ImageList1 Properties:
Name:
Images:
ImageSize:
TransparentColor: |
ImageList1
(Collection)
16,16
Transparent |
|
Add one image
to this ImageList:
When you click Collection of Images
property, the Image Collection Editor dialog box
appears.
In this
Editor dialog click Add, the Open Dialog
box appears
In this dialog, display list of files stored in the folder
c:\App-VBNet\Pic
In the Filename combo box type butterfly1
In the Files Type combo box choose All image
...
and then click Open
Automatically, lists of information display in the Image
Collection Editor dialog box, and then click OK
-
Add the ImageList control -
ImageList2 Properties:
Name:
Images:
ImageSize:
TransparentColor: |
ImageList2
(Collection)
16,16
Transparent |
|
Add one image
to this ImageList:
When you click Collection of Images
property, the Image Collection Editor dialog box
appears.
In this
Editor dialog click Add, the Open Dialog
box appears
In the Open dialog, display list of files stored in
the folder c:\App-VBNet\Pic
In the Filename combo box type butterfly1
In the Files Type combo box choose All image
...
and then click Open
Automatically, lists of information display in the Image
Collection Editor dialog box, and then click OK
-
Add the ListView control
-
Listview1, ListView Properties:
Name:
Font:
LargeImageList:
Size:
SmallImageList:
View: |
Listview1
Microsoft Sans Serief, 8.25pt
ImageList2
288,88
ImageList1
Details |
|
-
Add the Label control
-
lbinfo1, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
lbinfo1
Times New Roman, 8.25pt
288,16
.
TopLeft |
|
|
|
7- |
The Book.vb
design, Part 3 |
|

|
8- |
From
the Toolbox/Windows Form
add the 3th List of controls ....
Five Label controls and
four ComboBox controls.
|
|
-
Add the Label control
-
Label4, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label4
Microsoft Sans Serief, 8.25pt
64,16
TopLeft |
|
-
Add the Label control
-
Label5, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label5
Microsoft Sans Serief, 8.25pt
64,16
TopLeft |
|
-
Add the Label control
-
Label6, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label6
Microsoft Sans Serief, 8.25pt
64,16
TopLeft |
|
-
Add the Label control
-
Label7, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label7
Microsoft Sans Serief, 8.25pt
64,16
TopLeft |
|
-
Add the Label control
-
Label8, Label Properties:
Name:
Font:
Size:
Text:
TextAlign: |
Label8
Times New Roman, 975
100,16
TopLeft |
|
-
Add the Combo Box control -
cmbtitle Properties:
Name:
DropDownStyle:
Size:
Sorted: |
cmbtitle
DropDown
120,21
False |
|
-
Add the Combo Box control -
cmbbook Properties:
Name:
DropDownStyle:
Size:
Sorted: |
cmbbook
DropDown
120,21
False |
|
-
Add the Combo Box control -
cmbchapter Properties:
Name:
DropDownStyle:
Size:
Sorted: |
cmbchapter
DropDown
120,21
False |
|
-
Add the Combo Box control -
cmbverse Properties:
Name:
DropDownStyle:
Size:
Sorted: |
cmbverse
DropDown
120,21
False |
|
|
|
|
The
codes corresponding ...
|
|