|
The Form - BookForm.cs ...
|
1st part -
Resize, View, Navigation and Show
Forms
The text Code is red
color,
corresponding to Load data in the Statusbar
control The text Code is Maroon
color,
corresponding to activate the button
btnabout
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 BookForm.
///
</summary>
public
class
BookForm : System.Windows.Forms.Form
{
private
System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
private
App_VCSNet.Bookdset objBookdset;
private
System.Windows.Forms.Label lblBook;
private
System.Windows.Forms.Label lblBookTitle;
private
System.Windows.Forms.Label lblChapter;
private
System.Windows.Forms.TextBox editBook;
private
System.Windows.Forms.TextBox editBookTitle;
private
System.Windows.Forms.TextBox editChapter;
private
System.Windows.Forms.Label lblVerse;
private
System.Windows.Forms.TextBox editTextData;
private
System.Windows.Forms.TextBox editVerse;
private
System.Windows.Forms.Button btnNavFirst;
private
System.Windows.Forms.Button btnNavPrev;
private
System.Windows.Forms.Label lblNavLocation;
private
System.Windows.Forms.Button btnNavNext;
private
System.Windows.Forms.Button btnLast;
private
System.Windows.Forms.ImageList imageList1;
private
System.Windows.Forms.PictureBox pictureBox1;
private
System.Windows.Forms.PictureBox pictureBox2;
private
System.Windows.Forms.TabControl tabControl1;
private
System.Windows.Forms.Label label1;
private
System.Windows.Forms.Button btnabout;
private
System.Windows.Forms.Button btnDone;
private
System.Windows.Forms.TabPage tabPage1;
private
System.Windows.Forms.TabPage tabPage2;
private
System.Windows.Forms.Label label2;
private
System.Windows.Forms.Label label3;
private
System.Windows.Forms.Label label4;
private
System.Windows.Forms.TextBox TxtWord;
private
System.Windows.Forms.Button btnsearch;
private
System.Windows.Forms.Button btnview;
private
System.Windows.Forms.ListView listView1;
private
System.Windows.Forms.Label lbinfo1;
private
System.Windows.Forms.ImageList imageList2;
private
System.Windows.Forms.ComboBox cmbtitle;
private
System.Windows.Forms.ComboBox cmbbook;
private
System.Windows.Forms.ComboBox cmbchapter;
private
System.Windows.Forms.ComboBox cmbverse;
private
System.Windows.Forms.Label label5;
private
System.Windows.Forms.Label label6;
private
System.Windows.Forms.Label label7;
private
System.Windows.Forms.Label label8;
private
System.Windows.Forms.Label label9;
private
System.Windows.Forms.RichTextBox richTextData;
private
System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private
System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private
System.Data.OleDb.OleDbConnection oleDbConnection1;
private
System.ComponentModel.IContainer components;
App_VCSNet.MainForm fm =
new
MainForm();
int
View_Listview;
int
vrow;
// Select command
System.Data.OleDb.OleDbCommand selectCMD ;
// Data adapter
System.Data.OleDb.OleDbDataAdapter bookDA =
new
System.Data.OleDb.OleDbDataAdapter();
// DataSet
System.Data.DataSet KJVDSet;
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override
void
Dispose (bool
disposing)
|
|
Windows
Form Designer generated Code
|
private
void
BookForm_Load(object
sender, System.EventArgs e)
{
try
{
// Attempt to
load the dataset.
this.LoadDataSet();
// display the
2nd record of The 'BibleTable' table
this.BindingContext[objBookdset,"BibleTable"].Position
= 2;
// ListView
control, set the view to show details.
this.listView1.View
= View.Details;
View_Listview = 1;
// ComboBox
controls, search by Address
selectCMD = new
System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle,
Chapter, Verse, TextData FROM BibleTable ORDER BY Book,
Chapter, Verse",
this.oleDbConnection1);
selectCMD.Connection =
this.oleDbConnection1;
bookDA.SelectCommand = selectCMD;
KJVDSet= new
System.Data.DataSet();
this.oleDbConnection1.Open();
bookDA.Fill(KJVDSet,"BibleTable");
this.oleDbConnection1.Close();
/**
1- Cmbbook stores the orders of all books.
2- Cmbbookrecno stores the orders of the KJV records
corresponding to the items of Cmbbook.
3- Cmbtitle stores the titles of books
4- Cmbtitlerecno stores the orders of the KJV records
corresponding to the items of Cmbtitle.
**/
for
(vrow = 2; vrow <= KJVDSet.Tables["BibleTable"].Rows.Count
- 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== "001") && (KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()==
"001"))
{
this.cmbtitle.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["BookTitle"].ToString());
this.cmbbook.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString());
}
}
}
catch
(System.Exception eLoad)
{
// Add your error
handling code here.
// Display error
message, if any.
System.Windows.Forms.MessageBox.Show(eLoad.Message);
}
this.objBookdset_PositionChanged();
// Navigation
controls, enebled(False or True
NavigationFP( false);
NavigationNL( true);
this.cmbtitle.Text
= "Select";
this.cmbbook.Text
= "Select";
this.cmbchapter.Text
= "no select";
this.cmbverse.Text
= "no select";
// 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.Bookdset objDataSetTemp;
objDataSetTemp =
new App_VCSNet.Bookdset();
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.
objBookdset.Clear();
// Merge the
records into the main dataset.
objBookdset.Merge(objDataSetTemp);
}
catch
(System.Exception eLoadMerge)
{
// Add your error
handling code here.
throw
eLoadMerge;
}
}
public
void
FillDataSet(App_VCSNet.Bookdset 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
NavigationFP( Boolean bval)
{
this.btnNavFirst.Enabled
= bval;
this.btnNavPrev.Enabled
= bval;
}
private
void
NavigationNL( Boolean bval)
{
this.btnNavNext.Enabled
= bval;
this.btnLast.Enabled
= bval;
}
private
void
objBookdset_PositionChanged()
{
this.lblNavLocation.Text
= ((((this.BindingContext[objBookdset,"BibleTable"].Position
+ 1)).ToString() + " of ")
+ ( this.BindingContext[objBookdset,"BibleTable"].Count
- 1).ToString());
// Navigation
controls enebled(True or False
if
((this.BindingContext[objBookdset,"BibleTable"].Position
) <= 2)
{
NavigationFP( false);
NavigationNL( true);
}
else
{
if
((this.BindingContext[objBookdset,
"BibleTable"].Position +1) >= (this.BindingContext[objBookdset,
"BibleTable"].Count))
{
NavigationFP( true);
NavigationNL( false);
}
else
{
NavigationFP( true);
NavigationNL( true);
}
}
}
private
void
btnNavFirst_Click(object
sender, System.EventArgs e)
{
this.BindingContext[objBookdset,"BibleTable"].Position
= 2;
this.objBookdset_PositionChanged();
}
private
void
btnNavPrev_Click(object
sender, System.EventArgs e)
{
if
(this.BindingContext[objBookdset,"BibleTable"].Position
> 2)
{
this.BindingContext[objBookdset,"BibleTable"].Position
= (this.BindingContext[objBookdset,"BibleTable"].Position
- 1);
this.objBookdset_PositionChanged();
}
}
private
void
btnNavNext_Click(object
sender, System.EventArgs e)
{
this.BindingContext[objBookdset,"BibleTable"].Position
= (this.BindingContext[objBookdset,"BibleTable"].Position
+ 1);
this.objBookdset_PositionChanged();
}
private
void
btnLast_Click(object
sender, System.EventArgs e)
{
this.BindingContext[objBookdset,"BibleTable"].Position
= (this.objBookdset.Tables["BibleTable"].Rows.Count
- 1);
this.objBookdset_PositionChanged();
}
private
void
btnabout_Click(object
sender, System.EventArgs e)
{
About Fabout =
new About();
// StatusBar
Panel N1 = Message
fm.Show();
fm.statusBarPanel1.Text = "About Form, moment ...";
fm.Refresh();
Fabout.Show();
}
private
void
btnDone_Click(object
sender, System.EventArgs e)
{
this.Close();
} | |
|
2nd part
- search By word
In this part, use dataadapter ,
dataset and Select command -
( bookDA, KJVDset and SelectCMD )
created by
software
Note:
* Select
command
System.Data.OleDb.OleDbCommand selectCMD ; *
Dataadapter
System.Data.OleDb.OleDbDataAdapter bookDA =
new
System.Data.OleDb.OleDbDataAdapter();
*
Dataset
System.Data.DataSet KJVDSet;
|
|
private
void
TxtWord_KeyPress(object
sender, System.Windows.Forms.KeyPressEventArgs e) {
// btnSearch is
enabled, if the lenght of the word typed in the TxtWord
control > 1
if
(this.TxtWord.Text.Length
> 1)
{
this.btnsearch.Enabled
= true;
this.btnview.Enabled
= false;
}
}
private
void
btnsearch_Enter(object
sender, System.EventArgs e)
{
this.lbinfo1.Text
= "Moment ...";
}
private
void
btnsearch_Click(object
sender, System.EventArgs e)
{
// Variable
int
IFound = 0;
selectCMD = new
System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle,
Chapter, Verse, TextData FROM BibleTable ORDER BY Book,
Chapter, Verse",
this.oleDbConnection1);
selectCMD.Connection =
this.oleDbConnection1;
bookDA.SelectCommand = selectCMD;
KJVDSet= new
System.Data.DataSet();
this.oleDbConnection1.Open();
bookDA.Fill(KJVDSet,"BibleTable");
this.oleDbConnection1.Close();
// Clear ...
this.listView1.Clear();
// Allow the user
to edit item text.
this.listView1.LabelEdit
= true;
// Allow the user
to rearrange columns.
this.listView1.AllowColumnReorder
= true;
// Select the
item and subitems when selection is made.
this.listView1.FullRowSelect
= true;
// Display grid
lines.
this.listView1.GridLines
= true;
// Column Header
this.listView1.Columns.Add("Position",
60, HorizontalAlignment.Center);
this.listView1.Columns.Add("Book",
40, HorizontalAlignment.Left);
this.listView1.Columns.Add("Book
title", 75, HorizontalAlignment.Left);
this.listView1.Columns.Add("Chapter",
45, HorizontalAlignment.Left);
this.listView1.Columns.Add("Verse",
45, HorizontalAlignment.Left);
for
(vrow = 2; vrow <= KJVDSet.Tables["BibleTable"].Rows.Count
- 1; vrow++)
{
// Use RichEdit
control to store TextData field
this.richTextData.Text
=
KJVDSet.Tables["BibleTable"].Rows[vrow]["TextData"].ToString().ToLower();
// Search by Word
operation, Use the Find function of RichText control if
the TxtWord Value exist
if
(this.richTextData.Find(this.TxtWord.Text.ToLower())
!= -1)
{
// Create item
and four sets of subitems.
ListViewItem item1 =
new
ListViewItem(System.Convert.ToString(vrow), 0);
// Place a check
mark next to the item.
item1.SubItems.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString());
item1.SubItems.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["BookTitle"].ToString());
item1.SubItems.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString());
item1.SubItems.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
//Add the items
to the ListView.
listView1.Items.AddRange( new
ListViewItem[]{item1});
// Number of
verse found
IFound = IFound + 1;
if
(IFound > 5000)
{
this.lbinfo1.Text
= " Search results for [" +
this.TxtWord.Text
+ "] - more then" + System.Convert.ToString(IFound) + "
verses found.";
goto
ExitPt;
}
}
}
//'Display the
number of items found
if
(IFound > 0)
this.lbinfo1.Text
= " Search results for [" +
this.TxtWord.Text
+ "] - " + System.Convert.ToString(IFound) + " verses
found.";
else
{
this.lbinfo1.Text
= " Search results for [" +
this.TxtWord.Text
+ "] - 0 verse found.";
}
ExitPt:
this.TxtWord.Text
= "";
this.TxtWord.Enabled
= true;
this.btnsearch.Enabled
= false;
this.btnview.Enabled
= true;
}
private
void
btnview_Click(object
sender, System.EventArgs e)
{
View_Listview = View_Listview + 1;
switch(View_Listview)
{
case
1:
this.listView1.View
= View.Details;
break;
case
2:
this.listView1.View
= View.LargeIcon;
break;
case
3:
this.listView1.View
= View.List;
break;
case
4:
this.listView1.View
= View.SmallIcon;
break;
case
5:
goto
case
1;
}
}
private
void
listView1_Click(object
sender, System.EventArgs e)
{
this.BindingContext[objBookdset,"BibleTable"].Position
= System.Convert.ToInt16(this.listView1.SelectedItems[0].Text);
// convert string to
int
this.objBookdset_PositionChanged();
} | |
|
3th part,
search By address In this part, use dataadapter , dataset and Select
command - (
bookDA, KJVDset and SelectCMD ) created by software
Note:
* Select
command
System.Data.OleDb.OleDbCommand selectCMD ;
*
Dataadapter
System.Data.OleDb.OleDbDataAdapter bookDA =
new
System.Data.OleDb.OleDbDataAdapter();
*
Dataset
System.Data.DataSet KJVDSet;
|
|
private
void
cmbtitle_SelectedIndexChanged(object
sender, System.EventArgs e) {
int
VPosition = 0;
selectCMD = new
System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle,
Chapter, Verse, TextData FROM BibleTable ORDER BY Book,
Chapter, Verse",
this.oleDbConnection1);
selectCMD.Connection =
this.oleDbConnection1;
bookDA.SelectCommand = selectCMD;
KJVDSet= new
System.Data.DataSet();
this.oleDbConnection1.Open();
bookDA.Fill(KJVDSet,"BibleTable");
this.oleDbConnection1.Close();
/**
1- Cmbbook stores the orders of all books.
2- Cmbtitle stores the titles of books
3- The Cmbchapter stores all chapters orders of the
book corresponding to the item selected
4- The Cmbverse stores all verses orders of the 1st
chapter of the book
**/
this.cmbchapter.Items.Clear();
this.cmbverse.Items.Clear();
for
(vrow = 2; vrow <= KJVDSet.Tables["BibleTable"].Rows.Count
- 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["BookTitle"].ToString()
== this.cmbtitle.SelectedItem.ToString())
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== "001") && (KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()==
"001"))
{
VPosition = vrow;
this.cmbchapter.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString());
this.cmbverse.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
goto
NextA1;
}
}
NextA1:
for
(vrow = VPosition + 1; vrow <=
KJVDSet.Tables["BibleTable"].Rows.Count - 1; vrow++)
{
if
(KJVDSet.Tables["BibleTable"].Rows[vrow]["BookTitle"].ToString()
== this.cmbtitle.SelectedItem.ToString())
{
if
(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== "001")
{
this.cmbverse.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
}
else
{
if
(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()
== "001")
{
this.cmbchapter.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString());
}
}
}
}
/**
1- The record displays into the Record data boxes,
includes the following data:
the order and title of the book corresponding to the
item selected,
the 1st chapter order of the book,
the 1st verse order of the 1st chapter
and the contents of the verse.
2- In the Cmbtitle, displays the item selected
3- In the Cmbbook, displays the title of the book
corresponding to the item selected
4- In the Cmbchapter, displays the 1st chapter order of
the book
5- In the Cmbverse, displays the 1st verse order of the
1st chapter
**/
this.BindingContext[objBookdset,"BibleTable"].Position
= VPosition;
this.objBookdset_PositionChanged();
this.cmbbook.SelectedIndex
= this.cmbtitle.SelectedIndex;
this.cmbchapter.SelectedIndex
= 0;
this.cmbverse.SelectedIndex
= 0;
}
private
void
cmbbook_SelectedIndexChanged(object
sender, System.EventArgs e)
{
int
VPosition = 0;
selectCMD = new
System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle,
Chapter, Verse, TextData FROM BibleTable ORDER BY Book,
Chapter, Verse",
this.oleDbConnection1);
selectCMD.Connection =
this.oleDbConnection1;
bookDA.SelectCommand = selectCMD;
KJVDSet= new
System.Data.DataSet();
this.oleDbConnection1.Open();
bookDA.Fill(KJVDSet,"BibleTable");
this.oleDbConnection1.Close();
/**
1- Cmbbook stores the orders of all books.
2- Cmbtitle stores the titles of books
3- The Cmbchapter stores all chapters orders of the
book corresponding to the item selected
4- The Cmbverse stores all verses orders of the 1st
chapter of the book
**/
this.cmbchapter.Items.Clear();
this.cmbverse.Items.Clear();
for
(vrow = 2; vrow <= KJVDSet.Tables["BibleTable"].Rows.Count
- 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString()
== this.cmbbook.SelectedItem.ToString())
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== "001") && (KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()==
"001"))
{
VPosition = vrow;
this.cmbchapter.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString());
this.cmbverse.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
goto
NextA2;
}
}
NextA2:
for
(vrow = VPosition + 1; vrow <=
KJVDSet.Tables["BibleTable"].Rows.Count - 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString()
== this.cmbbook.SelectedItem.ToString()))
{
if
(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== "001")
{
this.cmbverse.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
}
else
{
if
(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()
== "001")
{
this.cmbchapter.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString());
}
}
}
}
/**
1- The record displays into the Record data boxes,
includes the following data:
the order and title of the book corresponding to the
item selected,
the 1st chapter order of the book,
the 1st verse order of the 1st chapter
and the contents of the verse.
2- In the Cmbtitle, displays the title of the book
corresponding to the item selected
3- In the Cmbbook, displays the item selected
4- In the Cmbchapter, displays the 1st chapter order of
the book
5- In the Cmbverse, displays the 1st verse order of the
1st chapter
**/
this.BindingContext[objBookdset,"BibleTable"].Position
= VPosition;
this.objBookdset_PositionChanged();
this.cmbtitle.SelectedIndex
= this.cmbbook.SelectedIndex;
this.cmbchapter.SelectedIndex
= 0;
this.cmbverse.SelectedIndex
= 0;
}
private
void
cmbchapter_SelectedIndexChanged(object
sender, System.EventArgs e)
{
int
VPosition = 0;
selectCMD = new
System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle,
Chapter, Verse, TextData FROM BibleTable ORDER BY Book,
Chapter, Verse",
this.oleDbConnection1);
selectCMD.Connection =
this.oleDbConnection1;
bookDA.SelectCommand = selectCMD;
KJVDSet= new
System.Data.DataSet();
this.oleDbConnection1.Open();
bookDA.Fill(KJVDSet,"BibleTable");
this.oleDbConnection1.Close();
this.cmbverse.Items.Clear();
for
(vrow = 2; vrow <= KJVDSet.Tables["BibleTable"].Rows.Count
- 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString()
== this.cmbbook.Text)
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== this.cmbchapter.SelectedItem.ToString())
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()==
"001"))
{
VPosition = vrow;
this.cmbverse.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
goto
NextA3;
}
}
NextA3:
for
(vrow = VPosition + 1; vrow <=
KJVDSet.Tables["BibleTable"].Rows.Count - 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString()
== this.cmbbook.Text)
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== this.cmbchapter.SelectedItem.ToString()))
{
this.cmbverse.Items.Add(KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString());
}
}
/**
1- The record displays into the Record data boxes,
includes the following data:
the order and title of the book corresponding to the
item selected,
the 1st chapter order of the book,
the 1st verse order of the 1st chapter
and the contents of the verse.
2- In the Cmbtitle, displays the title of the book
3- In the Cmbbook, displays the title of the book
4- In the Cmbchapter, displays the item selected
5- In the Cmbverse, displays the 1st verse order of the
1st chapter
**/
this.BindingContext[objBookdset,"BibleTable"].Position
= VPosition;
this.objBookdset_PositionChanged();
this.cmbverse.SelectedIndex
= 0;
}
private
void
cmbverse_SelectedIndexChanged(object
sender, System.EventArgs e)
{
int
VPosition = 0;
selectCMD = new
System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle,
Chapter, Verse, TextData FROM BibleTable ORDER BY Book,
Chapter, Verse",
this.oleDbConnection1);
selectCMD.Connection =
this.oleDbConnection1;
bookDA.SelectCommand = selectCMD;
KJVDSet= new
System.Data.DataSet();
this.oleDbConnection1.Open();
bookDA.Fill(KJVDSet,"BibleTable");
this.oleDbConnection1.Close();
for
(vrow = 2; vrow <= KJVDSet.Tables["BibleTable"].Rows.Count
- 1; vrow++)
{
if
((KJVDSet.Tables["BibleTable"].Rows[vrow]["Book"].ToString()
== this.cmbbook.Text)
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Chapter"].ToString()
== this.cmbchapter.Text)
&& (KJVDSet.Tables["BibleTable"].Rows[vrow]["Verse"].ToString()==
this.cmbverse.SelectedItem.ToString()))
{
VPosition = vrow;
goto
NextA4;
}
}
NextA4:
/**
1- The record displays into the Record data boxes,
includes the following data:
the order and title of the book corresponding to the
item selected,
the 1st chapter order of the book,
the 1st verse order of the 1st chapter
and the contents of the verse.
2- In the Cmbtitle, displays the title of the book
3- In the Cmbbook, displays the title of the book
4- In the Cmbchapter, displays the book chapter
5- In the Cmbverse, displays the item selected
**/
this.BindingContext[objBookdset,"BibleTable"].Position
= VPosition;
this.objBookdset_PositionChanged();
}
}
} | | |
|
|