The Visual J# .Net Form - Book.jsl, Text Codes
 
 
 

       
      Return



  The Form -  Book.jsl  ...

 
 

 The codes  corresponding ...
    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
 
 
 

package App_VJSNet;

import System.Drawing.*;

import System.Collections.*;

import System.ComponentModel.*;

import System.Windows.Forms.*;

import App_VJSNet.*;

/**

* Summary description for Book.

*/

public class Book extends System.Windows.Forms.Form

{

private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;

private App_VJSNet.Bookdset objBookdset;

private System.Windows.Forms.RichTextBox richTextData;

private System.Windows.Forms.Label label3;

private System.Windows.Forms.TabControl tabControl1;

private System.Windows.Forms.TabPage tabPage1;

private System.Windows.Forms.Label lbinfo1;

private System.Windows.Forms.ListView listView1;

private System.Windows.Forms.Button btnview;

private System.Windows.Forms.Button btnsearch;

private System.Windows.Forms.TextBox TxtWord;

private System.Windows.Forms.Label label8;

private System.Windows.Forms.TabPage tabPage2;

private System.Windows.Forms.ComboBox cmbverse;

private System.Windows.Forms.ComboBox cmbchapter;

private System.Windows.Forms.ComboBox cmbbook;

System.Windows.Forms.Label label9;

System.Windows.Forms.Label label10;

System.Windows.Forms.Label label11;

System.Windows.Forms.Label label12;

System.Windows.Forms.Label label13;

private System.Windows.Forms.ComboBox cmbtitle;

private System.Windows.Forms.PictureBox pictureBox2;

private System.Windows.Forms.Label label2;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Button btnDone;

private System.Windows.Forms.Button btnAbout;

private System.Windows.Forms.PictureBox pictureBox1;

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.ImageList imageList2;

private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;

private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;

private System.Data.OleDb.OleDbConnection oleDbConnection1;

private System.ComponentModel.IContainer components;

// Variables

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;

 

public Book()
 . .
 / * * */
protected void Dispose(boolean disposing)
 . .

 

 Windows form Designer generated code

private void Book_Load (Object sender, System.EventArgs e)

{

try

{

// Attempt to load the dataset.

this.LoadDataSet();

// display the 2nd record of The 'BibleTable' table

this.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(2);

// ListView control, set the view to show details.

this.listView1.set_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.set_Connection(this.oleDbConnection1);

bookDA.set_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.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow++)

{

if ((KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("Chapter").ToString().equals("001")) && (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("Verse").ToString().equals("001")))

{

this.cmbtitle.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("BookTitle").ToString());

this.cmbbook.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("Book").ToString());

}

}

}

catch (System.Exception eLoad)

{

// Add your error handling code here.

// Display error message, if any.

System.Windows.Forms.MessageBox.Show(eLoad.get_Message());

}

this.objBookdset_PositionChanged();

// Navigation controls, enebled(False or True

NavigationFP(false);

NavigationNL(true);

this.cmbtitle.set_Text("Select");

this.cmbbook.set_Text("Select");

this.cmbchapter.set_Text("no select");

this.cmbverse.set_Text("no select");

// 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.Bookdset objDataSetTemp;

objDataSetTemp = new App_VJSNet.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_VJSNet.Bookdset 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 NavigationFP( boolean bval)

{

this.btnNavFirst.set_Enabled(bval);

this.btnNavPrev.set_Enabled(bval);

}

private void NavigationNL( boolean bval)

{

this.btnNavNext.set_Enabled(bval);

this.btnLast.set_Enabled(bval);

}

private void objBookdset_PositionChanged ()

{

this.lblNavLocation.set_Text(((String.valueOf((this.get_BindingContext().get_Item(objBookdset,"BibleTable").get_Position() + 1)) + " of ")

+ String.valueOf(this.get_BindingContext().get_Item(objBookdset,"BibleTable").get_Count())));

// Navigation controls enebled(True or False

if (this.get_BindingContext().get_Item(objBookdset,"BibleTable").get_Position() <= 2)

{

NavigationFP(false);

NavigationNL(true);

}

else

{

if ((this.get_BindingContext().get_Item(objBookdset, "BibleTable").get_Position() +1) >= (this.get_BindingContext().get_Item(objBookdset, "BibleTable").get_Count()))

{

NavigationFP(true);

NavigationNL(false);

}

else

{

NavigationFP(true);

NavigationNL(true);

}

}

}

private void btnNavFirst_Click (Object sender, System.EventArgs e)

{

this.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(2);

this.objBookdset_PositionChanged();

}

private void btnNavPrev_Click (Object sender, System.EventArgs e)

{

if (this.get_BindingContext().get_Item(objBookdset,"BibleTable").get_Position() > 2)

{

this.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position((this.get_BindingContext().get_Item(objBookdset,"BibleTable").get_Position() - 1));

this.objBookdset_PositionChanged();

}

}

private void btnNavNext_Click (Object sender, System.EventArgs e)

{

this.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position((this.get_BindingContext().get_Item(objBookdset,"BibleTable").get_Position() + 1));

this.objBookdset_PositionChanged();

}

private void btnLast_Click (Object sender, System.EventArgs e)

{

this.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position((this.objBookdset.get_Tables().get_Item("BibleTable").get_Rows().get_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.set_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 ;

   *  Data adapter
       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.get_Text().length() > 1)

{

this.btnsearch.set_Enabled(true);

this.btnview.set_Enabled(false);

}

}

private void btnsearch_Enter (Object sender, System.EventArgs e)

{

this.lbinfo1.set_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.set_Connection(this.oleDbConnection1);

bookDA.set_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.set_LabelEdit(true);

// Allow the user to rearrange columns.

this.listView1.set_AllowColumnReorder(true);

// Select the item and subitems when selection is made.

this.listView1.set_FullRowSelect(true);

// Display grid lines.

this.listView1.set_GridLines(true);

// Column Header

this.listView1.get_Columns().Add("Position", 60, HorizontalAlignment.Center);

this.listView1.get_Columns().Add("Book", 40, HorizontalAlignment.Left);

this.listView1.get_Columns().Add("Book title", 75, HorizontalAlignment.Left);

this.listView1.get_Columns().Add("Chapter", 45, HorizontalAlignment.Left);

this.listView1.get_Columns().Add("Verse", 45, HorizontalAlignment.Left);

for (vrow = 2; vrow <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow++)

{

// Use RichEdit control to store TextData field

this.richTextData.set_Text(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("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.get_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.get_SubItems().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("Book").ToString());

item1.get_SubItems().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("BookTitle").ToString());

item1.get_SubItems().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("Chapter").ToString());

item1.get_SubItems().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow).get_Item("Verse").ToString());

//Add the items to the ListView.

listView1.get_Items().AddRange(new ListViewItem[]{item1});

// Number of verse found

IFound = IFound + 1;

}

}

// Display the number of items found

if (IFound <= 0)

this.lbinfo1.set_Text( " Search results for [" + this.TxtWord.get_Text() + "] - 0 verse found.");

else

this.lbinfo1.set_Text(" Search results for [" + this.TxtWord.get_Text() + "] - " + System.Convert.ToString(IFound) + " verses found.");

this.TxtWord.set_Text("");

this.TxtWord.set_Enabled(true);

this.btnsearch.set_Enabled(false);

this.btnview.set_Enabled(true);

}

private void btnview_Click (Object sender, System.EventArgs e)

{

View_Listview = View_Listview + 1;

if (View_Listview == 1)

this.listView1.set_View(View.Details);

else

{

if (View_Listview == 2)

this.listView1.set_View(View.LargeIcon);

else

{

if (View_Listview == 3)

this.listView1.set_View(View.List);

else

{

if (View_Listview == 4)

this.listView1.set_View(View.SmallIcon);

else

{

View_Listview= 1;

this.listView1.set_View(View.Details);

}

}

}

}

}

private void listView1_Click (Object sender, System.EventArgs e)

{

this.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(System.Convert.ToInt16(this.listView1.get_SelectedItems().get_Item(0).get_Text().ToString())); // 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 ;

   *  Data adapter
       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;

int vrow1;

selectCMD = new System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle, Chapter, Verse, TextData FROM BibleTable ORDER BY Book, Chapter, Verse", this.oleDbConnection1);

selectCMD.set_Connection(this.oleDbConnection1);

bookDA.set_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.get_Items().Clear();

this.cmbverse.get_Items().Clear();

for (vrow1 = 2; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("BookTitle").ToString().equals(this.cmbtitle.get_SelectedItem().ToString()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals("001") && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("verse").ToString().equals("001"))

{

VPosition = vrow1;

this.cmbchapter.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString());

this.cmbverse.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString());

}

}

for (vrow1 = VPosition + 1; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("BookTitle").ToString().equals(this.cmbtitle.get_SelectedItem().ToString()))

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals("001"))

{

this.cmbverse.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString());

}

else

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString().equals("001"))

{

this.cmbchapter.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("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.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(VPosition);

this.objBookdset_PositionChanged();

this.cmbbook.set_SelectedIndex(this.cmbtitle.get_SelectedIndex());

this.cmbchapter.set_SelectedIndex(0);

this.cmbverse.set_SelectedIndex(0);

}

private void cmbbook_SelectedIndexChanged (Object sender, System.EventArgs e)

{

int VPosition = 0;

int vrow1;

selectCMD = new System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle, Chapter, Verse, TextData FROM BibleTable ORDER BY Book, Chapter, Verse", this.oleDbConnection1);

selectCMD.set_Connection(this.oleDbConnection1);

bookDA.set_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.get_Items().Clear();

this.cmbverse.get_Items().Clear();

for (vrow1 = 2; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Book").ToString().equals(this.cmbbook.get_SelectedItem().ToString()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals("001") && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString().equals("001"))

{

VPosition = vrow1;

this.cmbchapter.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString());

this.cmbverse.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString());

}

}

for (vrow1 = VPosition + 1; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Book").ToString().equals(this.cmbbook.get_SelectedItem().ToString()))

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals("001"))

{

this.cmbverse.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString());

}

else

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString().equals("001"))

{

this.cmbchapter.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("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.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(VPosition);

this.objBookdset_PositionChanged();

this.cmbtitle.set_SelectedIndex(this.cmbbook.get_SelectedIndex());

this.cmbchapter.set_SelectedIndex(0);

this.cmbverse.set_SelectedIndex(0);

}

private void cmbchapter_SelectedIndexChanged (Object sender, System.EventArgs e)

{

int VPosition = 0;

int vrow1;

selectCMD = new System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle, Chapter, Verse, TextData FROM BibleTable ORDER BY Book, Chapter, Verse", this.oleDbConnection1);

selectCMD.set_Connection(this.oleDbConnection1);

bookDA.set_SelectCommand(selectCMD);

KJVDSet= new System.Data.DataSet();

this.oleDbConnection1.Open();

bookDA.Fill(KJVDSet,"BibleTable");

this.oleDbConnection1.Close();

this.cmbverse.get_Items().Clear();

for (vrow1 = 2; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Book").ToString().equals(this.cmbbook.get_Text()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals(this.cmbchapter.get_SelectedItem().ToString()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString().equals("001"))

{

VPosition = vrow1;

this.cmbverse.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString());

}

}

for (vrow1 = VPosition + 1; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Book").ToString().equals(this.cmbbook.get_Text()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals(this.cmbchapter.get_SelectedItem().ToString()))

{

this.cmbverse.get_Items().Add(KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("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.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(VPosition);

this.objBookdset_PositionChanged();

this.cmbverse.set_SelectedIndex(0);

}

private void cmbverse_SelectedIndexChanged (Object sender, System.EventArgs e)

{

int VPosition = 0;

int vrow1;

selectCMD = new System.Data.OleDb.OleDbCommand("SELECT Book, BookTitle, Chapter, Verse, TextData FROM BibleTable ORDER BY Book, Chapter, Verse", this.oleDbConnection1);

selectCMD.set_Connection(this.oleDbConnection1);

bookDA.set_SelectCommand(selectCMD);

KJVDSet= new System.Data.DataSet();

this.oleDbConnection1.Open();

bookDA.Fill(KJVDSet,"BibleTable");

this.oleDbConnection1.Close();

for (vrow1 = 2; vrow1 <= KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Count() - 1; vrow1++)

{

if (KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Book").ToString().equals(this.cmbbook.get_Text()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Chapter").ToString().equals(this.cmbchapter.get_Text()) && KJVDSet.get_Tables().get_Item("BibleTable").get_Rows().get_Item(vrow1).get_Item("Verse").ToString().equals(this.cmbverse.get_SelectedItem().ToString()))

{

VPosition = vrow1;

}

}

/**

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.get_BindingContext().get_Item(objBookdset,"BibleTable").set_Position(VPosition);

this.objBookdset_PositionChanged();

}

}



 

      Return