|
 |
CWFApp1 Database Window Application
developed with Microsoft Visual C#
2019 | |
 |
|
|
|
|
|
|
|
The Microsoft Visual C# 2019 member of the Microsoft
Visual Studio Community 2019 |
|
|
|
|
|
|
|
|
|
|
|
|
|
CWFApp1
Database
Window Application.., describe
how to use Microsoft Visual C# 2019 to create game application
1- |
CWFApp1 Database Executable (exe file)
| |
|
-
CWFApp1
Database Software,
Developed with
Microsoft Visual
C# 2019 (& used .Net
Framework 4.7.2),
but The Microsoft Access database manage the data.
(The Microsoft
Access database
file -
KJV2002.mdb)
-
Functions: Navigate,
Search, ....
-
Executable
Database Software
(exe file), Developed with
Microsoft Visual C# 2019
|
| |
|
|
2- |
The
Microsoft Visual C# 2019 member of the Microsoft
Visual Studio Community 2019 |
|
|
3- |
How Create
a C# application project. |
|
-
Open Visual Studio 2019.
-
On the start window, choose Create
a new project.
-
On the Create
a new project window, choose
the Windows
Forms App (.NET Framework) template for
C#.
(If you prefer, you can refine your search to quickly get to
the template you want. For example, enter or type Windows
Forms App in the search box. Next,
choose C# from
the Language list, and then choose Windows from
the Platform list.)
-
In the Configure
your new project window, type or
enter HelloWorld in
the Project
name box. Then,
choose Create.
-
Visual Studio opens your new project.
-
Create the application After you
select your C# project template and name your file, Visual Studio
opens a form for you. A form is a Windows user interface.
We'll create a "Hello World" application by adding controls
to the form, and then we'll run the application.
-
Note:
the Name of the
default Form created - Form1.cs, Before to Add controls,
it is Available to Modify the name and Proprieties of this
Form
-
Add
a "Controls" to this form ...
-
Note: Example, to Create DataSource / Dataset ... - KJV2002.mdb
|
|
|
 |
Note: Example, to Create DataSource / Dataset ... - KJV2002.mdb | |
|
|
1- |
Create a dataset for an .mdb
file - (Ex: KJV2002.mdb) |
|
|
1.1- |
Connect to databases created with Access 2000-2003 by
using the following procedure.
- Open a Windows Forms or WPF application project in Visual Studio.
- On the View menu, select Other
Windows > Data Sources.
- In the Data Sources window, click Add New
Data Source
The Data Source Configuration
Wizard opens.
.
- Select Database on the Choose a Data Source
Type page, and then select Next.
- Select Dataset on the Choose a Database
Model page, and then select
Next.
-
Add & Test
Connection
- On the Choose your Data Connection page, select
New Connection to configure a new data connection
-
If the data source is not Microsoft Access Database File
(OLE DB), select Change to open the
Change Data Source dialog box and select
Microsoft Access Database File, and then select
OK.
-
In the Database file name, specify the path and
name of the .mdb file you want to connect to, and then select
OK.

-
Select Next on the Choose your Data
Connection page.
-
Select Next on the Save connection string
to the Application Configuration file page.
-
Expand the Tables node on the Choose your
Database Objects page.
-
Select whatever tables or views you want in your dataset
, and then select Finish.
The dataset is added to your project, and the tables and views appear
in the Data Sources window.
|
|
|
2- |
Drag a data source from
the Data Sources window onto a form design surface
|
|
You can drag a data source from the Data
Sources window onto a form design surface or control. This causes
boilerplate code to be generated that displays the data from the data
store.
The following illustration shows a dataset that has been dropped onto a
Windows form. If you select F5 on the application, the
data from the underlying database appears in the form's controls.
|
|
|
|
|
|
| | | |
|
|
|
|
|
|
|
|
4- |
CWFApp1 Database Proprieties and
Solution
Explorer |
|
- CWFApp1 Database
Proprieties:
- the
Assembly/Project name : CWFApp1
-
Assembly Project Folder: C:\Users\...\source\repos\CWFApp1\
-
the Target framework: .Net Framework 4.7.2
-
the Output
type: Window Application
-
Startup
object: CWFApp1.Program
|
 |
-
CWFApp1 Solution Explorer
- CWFApp1
project developed with C# 2019, consist
of:
- 4 Form
files -
MaiForm.cs,
Book.cs,
Biography.cs,
About.cs
- 1
Folder - pic
pic folder stores 1 Micosoft Access database
file - KJV2002.mdb
|
|
 |
|
|
|
5- |
How
to Run this
application
|
|
-
Remove the read-only
attribute of all
files in the folder -
C:\Users\...\source\repos\CWFApp1
- Run
the Microsoft Visual Studio
Community 2019.
- From
File menu, choose
Open
then
choose Project/Solution,
the Open Project dialog
box appears, select the
CWFApp1
project file -Type:
Microsoft Visual Studio
Solution
(C:\Users\...\source\repos\CWFApp1
\CWFApp1 .sln)
and then click Open.
- From
Debug menu, choose
and click Start
Debugging
|
|
|
6- |
After
running CWFApp1, the following View design
display by order |
|
|
 |
CWFApp1 Database Application developed with Microsoft
Visual Studio Community 2019, C# - Face Game
| |
CWFApp1 Database Application developed with
Microsoft Visual Studio Community 2019, C# |
1. |
- Database Software,
using Access file
- KJV2002.mdb.
- Functions: Navigation, Search
and Animation.
- Includes
four Forms
- Classes used :
DataSet, Button,
ComboBox, Label,
TabControl,
ListView, MainMenu,
PictureBox, RichTextBox,
StausBar, TextBox,Timer
- Software Classes:
Connection and DataAdapter
|
2. |
1st Form -
MainForm.cs |
|
The design
|
 |
Functions
|
Use the Menu, to call
other Forms
| |
3. |
2nd Form
- Book.cs |
|
a. |
Search
by word |
|
The design
|
 |
Functions |
Navigate between the records
Search by word
|
|
b. |
search
by address |
|
The design
|
 |
|
|
Functions |
Navigate between the records
Search by address
|
|
|
4. |
3th Form
- Biography.cs |
|
The design
|
 |
Functions
|
Animation | |
4. |
4th Form
- About.cs |
|
The design
|
 |
Functions
|
To
show information about
KJV2002_MIB file.
To
call the Form Biography
| | | | | |
|
|
|
|
|
|
7- |
MainForm.cs,
1st
Form of CWFApp1 project/Application |
|
7.1 |
View Design |
|
 |
|
|
7.2 |
View
Codes |
|
|
 |
the
Code of MainForm
Form | |
the Code of MainForm
Form of CWFApp1 Database Application developed
with Microsoft Visual Studio Community 2019, C# |
|
|
|
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
CWFApp1
{
public
partial
class
MainForm
: Form
{
public
MainForm()
{
InitializeComponent();
}
private
void
MainForm_Load(object
sender, EventArgs e)
{
// Resize ...
// PictureBox control
this.pictureBox1.Left
= ((this.Width
-
this.pictureBox1.Width)
/ 2);
this.pictureBox1.Top
=
this.Height
/ 4;
// this.pictureBox1.Image =
System.Drawing.Image.FromFile("G:\App\App-VCSNet
C#\pic\ingraphic1.bmp");
// Label control
this.label1.Width
=
this.Width
- 100;
this.label1.Left
= (this.Width
-
this.label1.Width)
/ 2;
this.label1.Top
=
this.Height
* 3 / 4;
this.statusBarPanel1.Width
= (this.Width
* 3) / 8;
this.statusBarPanel2.Width
=
this.Width
* 3 / 8;
this.statusBarPanel3.Width
=
this.Width
* 2 / 8;
// StatusBar Panel 1, Message
...
this.statusBarPanel1.Text
=
"Hello ...";
// StatusBarPanel2, Date ...
this.statusBarPanel2.Text
=
DateTime.Now.ToLongDateString();
this.statusBarPanel3.Text
=
DateTime.Now.ToLongTimeString();
}
private
void
ExitToolStripMenuItem_Click(object
sender, EventArgs e)
{
Application.Exit();
}
private
void
BiographyToolStripMenuItem_Click(object
sender, EventArgs e)
{
Biography FBiography =
new
Biography();
// StatusBar Panel 1 =
Message
this.statusBarPanel1.Text
=
"Biography Form, moment ...";
FBiography.Show();
}
private
void
BookToolStripMenuItem_Click(object
sender, EventArgs e)
{
Book FBook =
new
Book();
// StatusBar Panel 1 =
Message
this.statusBarPanel1.Text
=
"Book Form, moment ...";
FBook.Show();
}
private
void
AboutToolStripMenuItem_Click(object
sender, EventArgs e)
{
About Fabout =
new
About();
// StatusBar Panel 1 =
Message
this.statusBarPanel1.Text
=
"About Form, moment ...";
Fabout.Show();
}
private
void
MainForm_FormClosed(object
sender, FormClosedEventArgs
e)
{
Application.Exit();
}
}
} |
|
| | | |
|
| |
|
|
8- |
Book.cs,
2nd
Form of CWFApp1
project/Application |
|
8.1 |
View
Design |
|
a- Search
by word |
|
 |
|
|
|
b- search
by address |
|
 |
8.2 |
View
Codes |
|
|
 |
the
Code of Book
Form | |
the Code of Book.cs Form
of
CWFApp1 Database Application
developed with
Microsoft Visual
Studio Community 2019, C# - Face
Game |
|
|
|
using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CWFApp1
{
public partial class Book :
Form
{
// Variables
//connection
System.Data.OleDb.OleDbConnection
BConnection1 = new
System.Data.OleDb.OleDbConnection();
// Select command
System.Data.OleDb.OleDbCommand
SelectCMDda;
System.Data.OleDb.OleDbCommand
SelectCMD;
// Data adapter
System.Data.OleDb.OleDbDataAdapter
Da = new
System.Data.OleDb.OleDbDataAdapter();
System.Data.OleDb.OleDbDataAdapter
BookDA = new
System.Data.OleDb.OleDbDataAdapter();
//Dataset
System.Data.DataSet KJVDSet;
int Vrow;
int Vposition;
int View_Listview = 0;
public Book()
{
InitializeComponent();
}
/// 1- DataBase - Resize,
View, Navigation and Show
Forms
private void Book_Load(object
sender, EventArgs e)
{
this.BConnection1.ConnectionString
=
@"Provider=""Microsoft.Jet.OLEDB.4.0"";Data
Source =|DataDirectory|\pic\KJV2002.mdb;Persist
Security Info=False;User ID=Admin;Mode=Share
Deny None;Jet OLEDB:Engine
Type=5;Jet OLEDB:Database
Locking Mode=1;Jet
OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Global Bulk
Transactions=1;Jet
OLEDB:Create System Database=False;Jet
OLEDB:Encrypt Database=False;Jet
OLEDB:Don't Copy Locale on
Compact=False;Jet
OLEDB:Compact Without Replica
Repair=False;Jet OLEDB:SFP=False";
try
{
// Attempt to load the
dataset.
this.LoadDataSet();
// display the 2nd record of
The 'BibleTable' table
this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position = 2;
}
catch (System.Exception eLoad)
{
// Add your error handling
code here.
// Display error message, if
any.
System.Windows.Forms.MessageBox.Show(eLoad.Message);
}
this.KJV2002BookDSet1_PositionChanged();
// Navigation controls,
enebled(False or True
NavigationFP(false);
NavigationNL(true);
//Combobox
this.Cmbtitle.Text =
"Select";
for (Vrow = 2; Vrow <=
this.kjV2002BookDSet1.BibleTable.Rows.Count
- 1; Vrow++)
{
if
((this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["Chapter"].ToString()
== "001") &&
(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["Verse"].ToString()
== "001"))
{
this.Cmbtitle.Items.Add(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["BookTitle"].ToString());
this.Cmbbook.Items.Add(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["Book"].ToString());
}
}
//View is Detail
View_Listview = 1;
this.Btnview.Text = "View
Details";
this.ListView0.View =
View.Details;
//ComboBox
this.Cmbtitle.Text =
"Select";
this.Cmbbook.Text = "Select";
this.Cmbchapter.Text = "no
select";
this.Cmbverse.Text = "no
select";
}
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.
CWFApp1.KJV2002BookDSet
ObjDataSetTemp;
ObjDataSetTemp = new
CWFApp1.KJV2002BookDSet();
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.
this.kjV2002BookDSet1.Clear();
// Merge the records into the
main dataset.
this.kjV2002BookDSet1.Merge(ObjDataSetTemp);
}
catch (System.Exception
eLoadMerge)
{
// Add your error handling
code here.
throw eLoadMerge;
}
}
public void
FillDataSet(CWFApp1.KJV2002BookDSet
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;
SelectCMDda = new
System.Data.OleDb.OleDbCommand("SELECT
Book, BookTitle, Chapter,
Verse, TextData FROM
BibleTable ORDER BY Book,
Chapter, Verse",
BConnection1);
SelectCMDda.Connection =
BConnection1;
Da.SelectCommand =
SelectCMDda;
try
{
// Open the connection.
BConnection1.Open();
// Attempt to fill the
dataset through the
DataAdapter da.
Da.Fill(dataSet, "BibleTable");
}
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.
BConnection1.Close();
}
}
private void
NavigationFP(Boolean bval)
{
this.Fbutton1.Enabled = bval;
this.Pbutton2.Enabled = bval;
}
private void
NavigationNL(Boolean bval)
{
this.Nbutton3.Enabled = bval;
this.Lbutton4.Enabled = bval;
}
private void
KJV2002BookDSet1_PositionChanged()
{
//Database, displays Values
of order and Fields - (Book,
Booktitle, Chapter, Verse,
BookText)
Vposition =
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position);
this.BtextBox1.Text =
this.kjV2002BookDSet1.BibleTable.Rows[Vposition]["Book"].ToString();
this.BTtextBox2.Text =
this.kjV2002BookDSet1.BibleTable.Rows[Vposition]["BookTitle"].ToString();
this.CtextBox3.Text =
this.kjV2002BookDSet1.BibleTable.Rows[Vposition]["Chapter"].ToString();
this.VtextBox4.Text =
this.kjV2002BookDSet1.BibleTable.Rows[Vposition]["Verse"].ToString();
this.TDtextBox1.Text =
this.kjV2002BookDSet1.BibleTable.Rows[Vposition]["TextData"].ToString();
//Navigation
this.PItextBox1.Text =
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position).ToString();
this.CtextBox2.Text = "of " +
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Count - 1).ToString();
// Navigation controls
enebled(True or False
if
((this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position) <= 2)
{
NavigationFP(false);
NavigationNL(true);
}
else
{
if
((this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position + 1)
>=
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Count))
{
NavigationFP(true);
NavigationNL(false);
}
else
{
NavigationFP(true);
NavigationNL(true);
}
}
}
private void
Fbutton1_Click(object sender,
EventArgs e)
{
this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position = 2;
this.KJV2002BookDSet1_PositionChanged();
}
private void
Pbutton2_Click(object sender,
EventArgs e)
{
if
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position > 2)
{
this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position =
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position - 1);
this.KJV2002BookDSet1_PositionChanged();
}
}
private void
Nbutton3_Click(object sender,
EventArgs e)
{
this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position =
(this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position + 1);
this.KJV2002BookDSet1_PositionChanged();
}
private void
Lbutton4_Click(object sender,
EventArgs e)
{
this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position =
(this.kjV2002BookDSet1.Tables["BibleTable"].Rows.Count
- 1);
this.KJV2002BookDSet1_PositionChanged();
}
/// 2- Search - ListView
Control>
============================================================
private void
Btnsearch_Click(object
sender, EventArgs e)
{
// Variable
int IFound = 0;
// Clear ...
this.ListView0.Clear();
// Allow the user to edit
item text.
this.ListView0.LabelEdit =
true;
// Allow the user to
rearrange columns.
this.ListView0.AllowColumnReorder
= true;
// Select the item and
subitems when selection is
made.
this.ListView0.FullRowSelect
= true;
// Display grid lines.
this.ListView0.GridLines =
true;
// Column Header
this.ListView0.Columns.Add("Record
#", 60,
HorizontalAlignment.Center);
this.ListView0.Columns.Add("Book",
45, HorizontalAlignment.Left);
this.ListView0.Columns.Add("Book
title", 80,
HorizontalAlignment.Left);
this.ListView0.Columns.Add("Chapter",
55, HorizontalAlignment.Left);
this.ListView0.Columns.Add("Verse",
55, HorizontalAlignment.Left);
// for (Vrow = 2; Vrow <=
this.kjV2002BookDSet1.BibleTable.Rows.Count
- 1; Vrow++)
for (Vrow = 2; Vrow <=
this.kjV2002BookDSet1.BibleTable.Rows.Count
- 1; Vrow++)
{
// Use RichEdit control to
store TextData field
this.TDWtextBox1.Text =
this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["TextData"].ToString().ToLower();
// Search by Word operation,
Use the Find function of
RichText control if the
TxtWord Value exist
if
(this.TDWtextBox1.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(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["Book"].ToString());
item1.SubItems.Add(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["BookTitle"].ToString());
item1.SubItems.Add(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["Chapter"].ToString());
item1.SubItems.Add(this.kjV2002BookDSet1.BibleTable.Rows[Vrow]["Verse"].ToString());
//Add the items to the
ListView.
ListView0.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
TxtWord_KeyPress(object
sender, 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
Btnview_Click(object sender,
EventArgs e)
{
View_Listview = View_Listview
+ 1;
switch (View_Listview)
{
case 1:
this.ListView0.View =
View.Details;
this.Btnview.Text = "View
Details";
break;
case 2:
this.ListView0.View =
View.LargeIcon;
this.Btnview.Text = "View L
Icon";
break;
case 3:
this.ListView0.View =
View.List;
this.Btnview.Text = "View
List";
break;
case 4:
this.ListView0.View =
View.SmallIcon;
this.Btnview.Text = "View S
Icon";
break;
case 5:
goto case 1;
}
}
private void
ListView0_Click(object
sender, EventArgs e)
{
this.BindingContext[this.kjV2002BookDSet1,
"BibleTable"].Position =
System.Convert.ToInt16(this.ListView0.SelectedItems[0].Text);
// convert string to int
this.KJV2002BookDSet1_PositionChanged();
}
/// <3- Search by address -
Combobox Controls>
============================================================
private void
Cmbtitle_SelectedIndexChanged(object
sender, EventArgs e)
{
int VPosition = 0;
//Initialize table BibleTable
this.InitCmb();
/**
* 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[this.kjV2002BookDSet1,
"BibleTable"].Position =
VPosition;
this.KJV2002BookDSet1_PositionChanged();
this.Cmbbook.SelectedIndex =
this.Cmbtitle.SelectedIndex;
this.Cmbchapter.SelectedIndex
= 0;
this.Cmbverse.SelectedIndex =
0;
}
private void InitCmb()
{
SelectCMD = new
System.Data.OleDb.OleDbCommand("SELECT
Book, BookTitle, Chapter,
Verse, TextData FROM
BibleTable ORDER BY Book,
Chapter, Verse",
BConnection1);
SelectCMD.Connection =
BConnection1;
BookDA.SelectCommand =
SelectCMD;
KJVDSet = new
System.Data.DataSet();
BConnection1.Open();
BookDA.Fill(KJVDSet, "BibleTable");
BConnection1.Close();
}
private void
Cmbbook_SelectedIndexChanged(object
sender, EventArgs e)
{
int VPosition = 0;
//Initialize table BibleTable
this.InitCmb();
/**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:
* he 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[this.kjV2002BookDSet1,
"BibleTable"].Position =
VPosition;
this.KJV2002BookDSet1_PositionChanged();
this.Cmbtitle.SelectedIndex =
this.Cmbbook.SelectedIndex;
this.Cmbchapter.SelectedIndex
= 0;
this.Cmbverse.SelectedIndex =
0;
}
private void
Cmbchapter_SelectedIndexChanged(object
sender, EventArgs e)
{
int VPosition = 0;
//Initialize table BibleTable
this.InitCmb();
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[this.kjV2002BookDSet1,
"BibleTable"].Position =
VPosition;
this.KJV2002BookDSet1_PositionChanged();
this.Cmbverse.SelectedIndex =
0;
}
private void
Cmbverse_SelectedIndexChanged(object
sender, EventArgs e)
{
int VPosition = 0;
//Initialize table BibleTable
this.InitCmb();
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[this.kjV2002BookDSet1,
"BibleTable"].Position =
VPosition;
this.KJV2002BookDSet1_PositionChanged();
}
private void
Dbutton1_Click(object sender,
EventArgs e)
{
this.Close();
// show MainForm ...";
CWFApp1.MainForm Fmain = new
MainForm();
Fmain.Show();
Fmain.Refresh();
}
private void
Book_FormClosed(object
sender, FormClosedEventArgs
e)
{
// show MainForm ...";
CWFApp1.MainForm Fmain = new
MainForm();
Fmain.Show();
Fmain.Refresh();
}
}
} |
|
| | | |
|
| |
|
|
9- |
Biography.cs,
3th
Form of CWFApp1
project/Application |
|
9.1 |
View Design |
|
 |
|
|
9.2 |
View
Codes |
|
|
 |
the
Code of Biography
Form | |
the Code of Biography.cs
Form of
CWFApp1 Database Application
developed with
Microsoft Visual
Studio Community 2019, C# - Face
Game |
|
|
|
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
CWFApp1
{
public
partial
class
Biography
: Form
{
int
IcoNmbr = 0;
public
Biography()
{
InitializeComponent();
}
private
void
Timer1_Tick(object
sender, EventArgs e)
{
if (IcoNmbr
== 0)
{
this.PictureBox1.Image
=
this.PictureBox2.Image;
IcoNmbr = 1;
}
else
{
this.PictureBox1.Image
=
this.PictureBox3.Image;
IcoNmbr = 0;
}
}
private
void
Biography_Load(object
sender, EventArgs e)
{
this.PictureBox1.Image
=
this.PictureBox2.Image;
IcoNmbr = 1;
}
private
void
BtnDone_Click(object
sender, EventArgs e)
{
// Close Biography Form
this.Close();
// show MainForm ...";
CWFApp1.MainForm Fmain =
new
MainForm();
Fmain.Show();
Fmain.Refresh();
}
private
void
Biography_FormClosed(object
sender, FormClosedEventArgs e)
{
// show MainForm ...";
CWFApp1.MainForm Fmain =
new
MainForm();
Fmain.Show();
Fmain.Refresh();
}
}
} |
|
| | | |
|
| |
|
|
10- |
About.cs,
3th
Form of CWFApp1
project/Application |
|
10.1 |
View
Design |
|
 |
|
|
10.2 |
View
Codes |
|
|
 |
the
Code of About
Form | |
the Code of About.cs
Form of
CWFApp1 Database Application
developed with
Microsoft Visual
Studio Community 2019, C# - Face
Game |
|
|
|
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
CWFApp1
{
public
partial
class
About
: Form
{
public
About()
{
InitializeComponent();
}
private
void
About_Load(object
sender, EventArgs e)
{
// TODO: This line of code
loads data into the
'kJV2002AboutDSet.BibleTable'
table. You can move, or
remove it, as needed.
this.bibleTableTableAdapter.Fill(this.kJV2002AboutDSet.BibleTable);
}
private
void
Btnbiography_Click(object
sender, EventArgs e)
{
CWFApp1.Biography
FBiography =
new
Biography();
// StatusBar Panel 1 =
Message
CWFApp1.MainForm Fmain =
new
MainForm();
Fmain.Show();
Fmain.statusBarPanel1.Text
=
"Biography Form, moment ...";
Fmain.Refresh();
FBiography.Show();
}
private
void
BtnDone_Click(object
sender, EventArgs e)
{
this.Close();
// show MainForm ...";
CWFApp1.MainForm Fmain =
new
MainForm();
Fmain.Show();
Fmain.Refresh();
}
private
void
About_FormClosed(object
sender, FormClosedEventArgs
e)
{
// show MainForm ...";
CWFApp1.MainForm Fmain =
new
MainForm();
Fmain.Show();
Fmain.Refresh();
}
}
} |
|
| | | |
|
| |
|
|
|
|
|
| | | | | |