You are on page 1of 108

DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify that “YOGINI ARORA (R1917680)”have successfully completed


the project entitled “OFFLINE EXAMINATION SYSYTEM” for 5th Semester as a
partial fulfillment of the requirements for the award of Degree in Bachelor of
Computer Applications, rewarded by the Bengaluru City University of Academic
year 2021-2022 .

Guide Head of Department


__________________ ________________

Mrs.Suma.C Dr. Prathiba V Kalburgi


Assistant Professor Dept of Computer Science

External Examiners

1.____________________

2._____________________

1
DECLARATION

The project titled “OFFLINE EXAMINATION SYSTEM” is developed by


me in the partial fulfillment of Bengaluru City University. It is a systematic
work carried by me under the guidance of Mrs.SUMA C, Asst Professor in
Computer Science department, M S RAMAIAH COLLEGE OF ARTS
SCIENCE AND COMMERCE, Bengaluru-54.
I, declare that this project has not been submitted to any degree or diploma to
Bengaluru City University or any other university.

SUBMITTED BY: YOGINI ARORA (R1917680)

DATE:

SIGNATURE:

2
SL.NO CONTENT PAGE
NO.

1. ACKNOWLEDGEMENT 04
2. INTRODUCTION 05
3. ABSTRACT 06
4. SOFTWARE AND HARDWARE 08
REQUIREMENT SPECIFICATION
5. ER DIAGRAMS 12
6. DATABASE 13
7. CODING 17
8. OUTPUTS 90
9. TESTING 100
10. CONCLUSION 107
11. BIBLIOGRAPHY 108

3
1.ACKNOWLEDGEMENT
This project would not have been possible without the guidance and
support of some of our well-wishers and we are ever indebted to them
for their contribution to our work.
Our principal. DR. A. NAGARTHNA for providing us the platform and a
congenial environment to work.
We're grateful to our HOD, DR. Prathiba V Kalburgi for her constant
support and for being as approachable as she has been all along. Most
importantly, we'd like to express our gratitude to our Project Guide, Mrs.
Suma C, who's been our guide, mentor and friend, not just for this project
but ever since our first days in the department. If not for Mrs Suma C,
none of our projects would have taken shape. We'd like to thank her for
trusting us with unconventional and innovative projects, giving us the
independence to take it forward with our ideas, motivating us when we
hit a road block and guiding us throughout the development phase with
his valuable inputs. We'd like to thank the staff of our department for
their much needed encouragement and the fellow students for providing
the best test case scenarios one could ever ask for.
We'd like to thank our families for supporting us throughout the
development process of the project, irrespective of the time of the day
or the number of hours spent in front of the computer. Thank you.
YOGINI ARORA

4
2. INTRODUCTION
Offline examination is a real time project. The
project will be implemented using VB.NET .The
aim of this project is to allow teachers to
conduct examinations for all the students. This
option is only available for the teachers to
terminate the exam. The teachers are also have
this option to set the time limit, edit questions,
and admin can get logged inn all the staff
members and can change the exam password.
When the students start their exam, after the
allotted time, the exam automatically ends and
a grade sheet is printed to the students.

5
3.ABSTRACT
The objective of making this offline
examination system software is to give the
efficiency of working on a software. Which
requires no internet and for the rural areas
where internet is not available they can conduct
the examination easily, efficiently and
reasonably.
How is it an advantage to the colleges and
schools to have the offline software like this?
ADV1: That this is reasonable.
ADV2: No use of internet.
ADV3: The result is automatically displayed on
the screen after the exam get terminated.
ADV4: Anybody can use this software you don’t
require to have any particular qualifications to
use this software.
ADV5: It is easy and efficient for any person to
use this software.
6
ADV6: Any course can be edited or deleted any
subject can be removed or added in the
software.
ADV7: We can pay the fees in this software
without an internet connection.

DISADVANTAGE
THE LAPTOPS OR COMPUTERS WHICH DOESN’T
HAVE VISUAL STUDIO OR MICROSOFT SQL IN
THEIR CONCERNED GADGETS THEY WILL NOT
BE ABLE TO USE THIS SOFTWARE.

7
4.SOFTWARE AND HARDWARE
REQUIREMENT SPECIFICATION:
Hardware Requirements:
Processor: 11th Gen Intel(R) Core (TM) i5-
2.40GHz 2.42 GHz
RAM:16GB
Software Requirements:
Operating System: WINDOWS
Front End: Visual Studio 2022(VB.NET)
Back End: Microsoft SQL server management
studio 18

8
About The Software
Visual studio:
Visual studio is an integrated development
environment(IDA) from Microsoft.
It is used to develop computer programs,website,web
apps,web service,mobile apps etc.
(.Net Framework)
.Net is a framework for developing web-based and
windows-based applications within the Microsoft
environment.
The framework offers a fundamental shift in Microsoft
strategy it moves application development from
clientcentric to server-centric.
Tools used in .Net framework
It comprises several tool bases to control a visual studio
program. we have used tool boxes to develop our project.
It can attach it to code that will run when the form is
loaded,closed or when the mouse is clicked or moved over
it.

9
FORM
The form is the center unit which is a window initially
blank,on which we can paste controls to create our screen
.The form can be of any size or color or we can attach to it
code that will run when the form is loaded,Closed oer
when the mouse is clicked or moved over it.

Labels and TextBoxes:


The boxes are an essential part of most visual studio
applictions.The key-difference between Label and Text
box are known at run time.Text boxes are used to process
the information’s entered into them.Text Boxes can word
wrap automatically or display multiple lines of text.
Button:
Button is one of the visual stdio object.it is one of method
of selection. they are typically used where there are only
a limited number of options.
Combo Box:
Combo box combines a drop down list with a slot in which
users can enter their own data when the program is
running. Advantage over a normal text box is that ,choices
can be presented without any need to type them in.The
10
Advantage over a list box is that a combo box takes less
space and also allow the user to type in a choice not in the
list.
Picture Box:
Picture box is one of the visual studio objects.it is used for
display the picture in our Form.

11
5.ER-DIAGRAM

12
6.DATABASE
TABLE LOGIN

TABLE STUDENT REGISTRATION

13
TABLE COURSE

TABLE APPROVE

TABLE COURSE FEES

14
TABLE EMPLOYEE

TABLE QUESTION

15
TABLE RESULTS

TABLE STUDENT ANSWER

TABLE PASSWORD

16
7.CODING

FORM 1

Public Class Form1


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub PictureBox2_Click(sender As Object, e As


EventArgs) Handles PictureBox2.Click
Me.Hide()
frmLogin.Show()
End Sub

Private Sub PictureBox3_Click(sender As Object, e As


EventArgs) Handles PictureBox3.Click
frmRegistration.Show()
End Sub

Private Sub PictureBox4_Click(sender As Object, e As


EventArgs) Handles PictureBox4.Click
frmfees.Show()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs)


Handles MyBase.Load
17
PictureBox2.Focus()
End Sub

Private Sub Button1_Click(sender As Object, e As


EventArgs) Handles Button1.Click
Me.Hide()
frmmaster.Show()
End Sub End
Class

FORM LOGIN
Imports System.Data
Imports System.Data.SqlClient

Public Class frmLogin


Private Sub btnexit_Click(sender As Object, e As EventArgs)
Handles btnexit.Click
Me.Hide()
Form1.Show()
End Sub

Private Sub Btnlogin_Click(sender As Object, e As


EventArgs) Handles Btnlogin.Click
Try

'validation
If Len(Trim(txtusername.Text)) = 0 Then
MessageBox.Show("Please enter Username", "Input
Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
18
txtusername.Focus()
Exit Sub
ElseIf (Len(Trim(txtpass.Text)) = 0) Then
MessageBox.Show("Please enter Password", "Input
Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtpass.Focus()
Exit Sub

ElseIf (Len(Trim(cmbusertype.Text)) = 0) Then


MessageBox.Show("Please select User type", "Input
Error", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
Exit Sub
End If

' login code---------------------------------


cmd = New SqlCommand("select * from tbl_login where
username=@username and password=@password and
usertype=@ut", con)
Dim UParam As New SqlParameter("@username",
Me.txtusername.Text)
Dim PassParam As New SqlParameter("@password",
Me.txtpass.Text)
Dim type As New SqlParameter("@ut",
Me.cmbusertype.Text)

19
cmd.Parameters.Add(UParam)
cmd.Parameters.Add(PassParam)
cmd.Parameters.Add(type) cmd.Connection = con
cmd.Connection.Open()
'run cmd
dr = cmd.ExecuteReader()
If dr.HasRows Then
name1 = txtusername.Text
utype = cmbusertype.Text
userpass = txtpass.Text

con.Close()

If (utype = "Admin") Then


Me.Hide()
frmMaster.Show()
ElseIf (utype = "Student") Then
Me.Hide()
frmExamQuestion.Show()
ElseIf (utype = "Staff") Then
Me.Hide()
frmMaster.Show() End If
con.Close()
Else
MsgBox("UserID & password not matched",
MsgBoxStyle.Critical, MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox(ex.Message)

20
Finally
con.Close()
End Try
End Sub
FORM MASTER
Imports System.Data.SqlClient

Public Class frmmaster


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
Form1.Show()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs)


Handles Button1.Click
frmRegistration.ShowDialog()
End Sub

Private Sub frmmaster_Load(sender As Object, e As


EventArgs) Handles MyBase.Load
lblUsername.Text = Module1.name1
Label3.Text = DateTime.Now.ToString()
End Sub

Private Sub ApprovalToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
ApprovalToolStripMenuItem.Click
21
With frmApprovalStudent
.TopLevel = False
Panel5.Controls.Add(frmApprovalStudent)
.BringToFront()
.Show()

End With
End Sub

Private Sub StudentHistoryToolStripMenuItem_Click(sender


As Object, e As EventArgs) Handles
StudentHistoryToolStripMenuItem.Click
With frmStudentHistory
.TopLevel = False
Panel5.Controls.Add(frmStudentHistory)

.BringToFront()
.Show()

End With
End Sub

Private Sub AddExamToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
AddExamToolStripMenuItem.Click
With frmAddQuestion
.TopLevel = False
Panel5.Controls.Add(frmAddQuestion)
.BringToFront()
22
.Show()

End With
End Sub

Private Sub ViewEditToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
ViewEditToolStripMenuItem.Click
With frmEditQuestion
.TopLevel = False
Panel5.Controls.Add(frmEditQuestion)
.BringToFront()
.Show()
End With
End Sub

Private Sub AddToolStripMenuItem_Click(sender As Object,


e As EventArgs) Handles AddToolStripMenuItem.Click
With frmAddEmployee
.TopLevel = False
Panel5.Controls.Add(frmAddEmployee)
.BringToFront()
.Show()

End With
End Sub

Private Sub ViewToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
23
ViewToolStripMenuItem.Click
With frmEmployeeViewList

.TopLevel = False
Panel5.Controls.Add(frmEmployeeViewList)
BringToFront()
.Show()

End With
End Sub
Private Sub NewToolStripMenuItem_Click(sender As Object,
e As EventArgs) Handles NewToolStripMenuItem.Click
With frmFeesPayment

.TopLevel = False
Panel5.Controls.Add(frmFeesPayment)
.BringToFront()
.Show()

End With
End Sub

Private Sub AddImageToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
AddImageToolStripMenuItem.Click
With frmaddstudimg
.TopLevel = False
Panel5.Controls.Add(frmaddstudimg)
.BringToFront()
24
.Show()
End With
End Sub

Private Sub ViewToolStripMenuItem1_Click(sender As


Object, e As EventArgs) Handles
ViewToolStripMenuItem1.Click
With frmFeesPaymentDatails
.TopLevel = False
Panel5.Controls.Add(frmFeesPaymentDatails)
.BringToFront()
.Show()
End With
End Sub

Private Sub ADDNEWToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
ADDNEWToolStripMenuItem.Click
With frmAddNewCourse

.TopLevel = False
Panel5.Controls.Add(frmAddNewCourse)
.BringToFront()
.Show()
End With
End Sub

Private Sub ExamPasswordToolStripMenuItem_Click(sender


25
As Object, e As EventArgs) Handles
ExamPasswordToolStripMenuItem.Click
qry = "select * from tblpassword"
con.Open()
cmd = New SqlCommand(qry, con)
dr = cmd.ExecuteReader() If
dr.Read Then
'open form password
With frmExamPasschange
.TopLevel = False
Panel5.Controls.Add(frmExamPasschange)
.BringToFront()
.Show()
End With
Else

With frmPassword
.TopLevel = False
Panel5.Controls.Add(frmPassword)
.BringToFront()
.Show()
End With

End If
If con.State = 1 Then con.Close()
End Sub

Private Sub Button3_Click(sender As Object, e As


EventArgs) Handles Button3.Click
frmApprovalStudent.ShowDialog()
26
End Sub

Private Sub Button2_Click(sender As Object, e As


EventArgs) Handles Button2.Click
frmStudentHistory.ShowDialog()

End Sub

Private Sub Button5_Click(sender As Object, e As


EventArgs) Handles Button5.Click
frmAddEmployee.ShowDialog()
End Sub

Private Sub Button4_Click(sender As Object, e As


EventArgs) Handles Button4.Click
frmAddQuestion.ShowDialog()
End Sub

Private Sub HomeToolStripMenuItem_Click(sender As


Object, e As EventArgs) Handles
HomeToolStripMenuItem.Click
Me.Close()
Form1.Show()
End Sub

27
FORM STUDENT REGISTRATION
Imports System.Data
Imports System.Data.SqlClient

Public Class frmRegistration

Private Sub frmRegistration_Load(sender As Object, e As


EventArgs) Handles MyBase.Load
If con.State = 1 Then con.Close()
LOAD_ANO()
load_course()
End Sub

Public Sub LOAD_ANO()


ds.clear()
txtstudtno.Clear()
If con.State = 1 Then con.Close()

con.Open() str = "select * from


tbl_registration" Dim cmd As
SqlCommand = cmd cmd = New
SqlCommand(str, con)
da.SelectCommand = cmd
da.Fill(ds, "tbl_registration")

Dim LastNo As Integer


LastNo = ds.Tables("tbl_registration").Rows.Count + 1

28
If LastNo >= 0 Then
txtstudtno.Text = LastNo Else
txtstudtno.Text = "1"
End If

If con.State = 1 Then con.Close()

End Sub

Public Sub load_course()


cmbcrs.Items.Clear() Dim
ctr As Integer con.Open()
str = "select distinct (course)from tbl_course"
cmd = New SqlCommand(str, con)
da.SelectCommand = cmd
da.Fill(ds, "tbl_course")
ctr = ds.Tables("tbl_course").Rows.Count - 1
For i = 0 To ctr

cmbcrs.Items.Add(ds.Tables("tbl_course").Rows(i)(0).ToString)
Next
con.Close()

End Sub

Public Sub radiogender()


If rdbtnfemale.Checked = True Then

29
gender = "female"
Else
gender = "male"
End If
End Sub

Private Sub PictureBox1_Click(sender As Object, e As


EventArgs) Handles PictureBox1.Click
Me.Dispose()
Form1.Show()

End Sub

Private Sub Btnlogin_Click(sender As Object, e As


EventArgs) Handles Btnlogin.Click
If con.State = 1 Then con.Close()
If txtstudtno.Text = "" Or txtstdtname.Text = "" Or
txtadd.Text = "" Or txtcontact.Text = "" Or (rdbtnmale.Checked
= False And rdbtnfemale.Checked = False) Or txtquli.Text = ""
Then
MsgBox("please enter all details")
Exit Sub
End If
Try
'check duplicate value

30
' qry = "select applicationnum form tbl_registration
where applicationnum=' " & txtapplicationnum.Text & "'"
cmd = New SqlCommand("select studno from
tbl_registration where studno=@studno", con)
Dim UParam As New SqlParameter("@studno",
Me.txtstudtno.Text)
cmd.Parameters.Add(UParam)
cmd.Connection = con cmd.Connection.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader()
If dr.HasRows Then
MsgBox(" STUDENT NUMBER IS ALREADY
EXIST")
con.Close()
Else
'insert record
If con.State = 1 Then con.Close()
radiogender()
qry = "insert into
tbl_registration(studno,studname,addr,contact_no,gender,course,
qualification,dob)values('" & txtstudtno.Text & "','" &
txtstdtname.Text & "','" & txtadd.Text & "','" & txtcontact.Text
& "','" & gender & "','" & cmbcrs.Text & "','" & txtquli.Text &
"',CONVERT(DATE,'" & DateTimePicker1.Value & "',103))"
cmd = New SqlCommand(qry, con)
cmd.Connection = con
cmd.Connection.Open() i=
cmd.ExecuteNonQuery()
If (i >= 1) Then
MsgBox("STUDENT REGISTRATION
SUCCESSFUL")
31
con.Close()
Else
MsgBox("Registration Failed")
con.Close()

End If

End If

Catch ex As Exception
MsgBox(ex.Message)
con.Close()

End Try
If con.State = 1 Then con.Close()

End Sub

Private Sub btnclear_Click(sender As Object, e As


EventArgs) Handles btnclear.Click
reset()
End Sub

Public Sub reset()


txtstudtno.Clear()
txtstdtname.Clear()
txtadd.Clear() txtcontact.Clear()
txtquli.Clear()
cmbcrs.SelectedIndex = -1
32
LOAD_ANO()

End Sub
Private Sub txtstudtno_TextChanged(sender As Object, e As
EventArgs) Handles txtstudtno.TextChanged

End Sub
End Class

FORM FEES
Imports System.Data
Imports System.Data.SqlClient

Public Class frmfees


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub frmfees_Load(sender As Object, e As EventArgs)


Handles MyBase.Load
showgv()

End Sub
Public Sub showgv()
Try
If con.State = 1 Then con.Close()
33
con.Open()
cmd = New SqlCommand("select course,fees from
tbl_course_fee ", con) da = New
SqlDataAdapter(cmd) Dim dt As New DataTable
da.Fill(dt)
If dt.Rows.Count > 0 Then
dgvfees.DataSource = dt
Else
MsgBox("Record Not Found or table is empty")

End If
Catch ex As Exception
MsgBox(ex.Message)

End Try
If con.State = 1 Then con.Close()
End Sub End
Class

FORM ADD COURSE


Imports System.Data.SqlClient

Public Class frmAddNewCourse


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()

34
End Sub

Private Sub btnAdd_Click(sender As Object, e As EventArgs)


Handles btnAdd1.Click
If cmbcourse1.Text = "" Or txtsubject1.Text = "" Then
MsgBox("Please enter the fields")
Else
qry = "select * from tbl_course where course='" &
cmbcourse1.Text & "'and subjects='" & txtsubject1.Text & "'and
part='" & cmbpart1.Text & "'"

cmd = New SqlCommand(qry, con)


If con.State = 1 Then con.Close()
con.Open()
dr = cmd.ExecuteReader
If dr.Read Then
MsgBox("course and subject already exist",
MsgBoxStyle.Critical)
cmbcourse1.Text = ""
txtsubject1.Clear()
Else
qry = "insert into tbl_course
(course,subjects,part)values('" & cmbcourse1.Text & "','" &
txtsubject1.Text & "','" & cmbpart1.Text & "')"
If con.State = 1 Then con.Close()

InsertData(qry)

MsgBox("Record Added Successfully",


MsgBoxStyle.Information)
35
txtsubject1.Clear()
cmbcourse1.Text = ""
cmbpart1.Text = ""
Bindcourse()
End If
End If
End Sub

Private Sub frmAddNewCourse_Load(sender As Object, e As


EventArgs) Handles MyBase.Load
Bindcourse()

End Sub
Private Sub Bindcourse() '-----------show all courses in
comboBox
cmbcourse1.Items.Clear()
ds.Clear()
If con.State = 1 Then con.Close()
qry = "select distinct (course) from tbl_course with
(nolock)"
FetchData(qry)

If ds.Tables(0).Rows.Count > 0 Then


Dim tblrow As Integer = ds.Tables(0).Rows.Count - 1
Dim i As Integer = 0
For i = 0 To tblrow

cmbcourse1.Items.Add(ds.Tables(0).Rows(i)(0).ToString())
Next
36
Else
MsgBox("Course Not Found")
End If
End Sub

Private Sub frmAddNewCourse_Load_1(sender As Object, e


As EventArgs) Handles MyBase.Load

End Sub

Private Sub PictureBox2_Click(sender As Object, e As


EventArgs) Handles PictureBox2.Click
Me.Dispose()

End Sub End


Class

FORM ADD QUESTION


Imports System.Data.SqlClient

Public Class frmAddQuestion


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()

End Sub
Private Sub frmAddQuestion_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
37
Bindcourse()
txtQno.ReadOnly = True
btnNext.Visible = False
btnAdd.Enabled = True

End Sub

Private Sub Bindcourse() '-----------show all courses in


comboBox
cmbCourse.Items.Clear()
ds.Clear()
If con.State = 1 Then con.Close()
qry = "select distinct (course) from tbl_course with
(nolock)"
ds = FetchData(qry)

If ds.Tables(0).Rows.Count > 0 Then


Dim tblrow As Integer = ds.Tables(0).Rows.Count - 1
Dim i As Integer = 0
For i = 0 To tblrow

cmbCourse.Items.Add(ds.Tables(0).Rows(i)(0).ToString())
Next
Else
MsgBox("Course Not Found...")
End If
End Sub

Private Sub Bindsubject() '-----------show all subject in


comboBox
38
cmbSubject.Items.Clear()
ds.Clear()
If con.State = 1 Then con.Close() qry = "select
distinct (subjects) from tbl_course with (nolock) where
course='" & cmbCourse.Text & "' "
ds=FetchData(qry)

If ds.Tables(0).Rows.Count > 0 Then


Dim tblrow As Integer = ds.Tables(0).Rows.Count - 1
Dim i As Integer = 0
For i = 0 To tblrow

cmbSubject.Items.Add(ds.Tables(0).Rows(i)(0).ToString())
Next
Else
MsgBox("Course Not Found...")
End If
End Sub

Private Sub cmbCourse_SelectedIndexChanged(sender As


Object, e As EventArgs) Handles
cmbCourse.SelectedIndexChanged
Bindsubject()
txtQno.Clear()

End Sub

Private Sub QuestionNo()


Dim Qno As String = ""
39
If con.State = 1 Then con.Close()

Try
qry = "select top 1 MAX(q_no)as QID from tbl_Question
where subject= '" & cmbSubject.Text & "'and course='" &
cmbCourse.Text & "' "
cmd = New SqlCommand(qry, con)
con.Open()
Dim dr1 As SqlDataReader = cmd.ExecuteReader()
If (dr1.Read()) Then
Qno = dr1.Item("QID").ToString
txtQno.Text = Val(Qno) + 1 '--------------add 1 in
previous value

End If

Catch ex As Exception
MsgBox(ex.Message)
End Try
If con.State = 1 Then con.Close()
End Sub

Private Sub cmbSubject_SelectedIndexChanged(sender As


Object, e As EventArgs) Handles
cmbSubject.SelectedIndexChanged
QuestionNo()
End Sub

Private Sub btnAdd_Click(sender As Object, e As EventArgs)

40
Handles btnAdd.Click
'validation code
If txtQno.Text.Trim() = "" Then
txtQno.Focus() : Exit Sub ElseIf
txtQus.Text.Trim() = "" Then
txtQus.Focus() : Exit Sub
ElseIf txtOptionA.Text.Trim() = "" Then
txtOptionA.Focus() : Exit Sub ElseIf
txtOptionB.Text.Trim() = "" Then
txtOptionB.Focus() : Exit Sub ElseIf
txtOptionC.Text.Trim() = "" Then
txtOptionC.Focus() : Exit Sub ElseIf
txtOptionD.Text.Trim() = "" Then
txtOptionD.Focus() : Exit Sub
ElseIf cmbcorrectAns.Text.Trim() = "" Then
cmbcorrectAns.Focus() : Exit Sub ElseIf
cmbCourse.Text.Trim() = "" Then
cmbCourse.Focus() : Exit Sub ElseIf
cmbSubject.Text.Trim() = "" Then
cmbSubject.Focus() : Exit Sub

End If
Try
qry = "Insert into
tbl_Question(q_no,course,subject,question,op_A,op_B,op_C,op
_D,answer)values('" & txtQno.Text & "','" & cmbCourse.Text &
"','" & cmbSubject.Text & "','" & txtQus.Text & "','" &
txtOptionA.Text & "','" & txtOptionB.Text & "','" &
txtOptionC.Text & "','" & txtOptionD.Text & "','" &
cmbcorrectAns.Text & "')"
41
i = InsertData(qry)
If (i > 0) Then
MsgBox("Question Added successful",
MsgBoxStyle.Information)
btnAdd.Enabled = False
btnNext.Enabled = True btnNext.Visible
= True
Else
MsgBox("Question Not Added ",
MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
MsgBox(ex.Message)

End Try
End Sub

Private Sub btnNext_Click(sender As Object, e As


EventArgs) Handles btnNext.Click
' clear some controls values
btnAdd.Enabled = True

txtQno.Clear()
txtQus.Clear()
txtQus.Focus()
txtOptionA.Clear()
txtOptionB.Clear()
txtOptionC.Clear()
txtOptionD.Clear()
cmbcorrectAns.Text = ""
42
QuestionNo()
btnNext.Visible = False

End Sub
End class
FORM EDIT QUESTION
Imports System.Data
Imports System.Data.SqlClient

Public Class frmEditQuestion


Private Sub frmEditQuestion_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
LoadRecord()
End Sub

Public Sub LoadRecord()


DataGridView1.Rows.Clear()
con.Close()
cmd = New SqlCommand("select * from tbl_Question
with(nolock)", con) con.Open()
dr = cmd.ExecuteReader
Dim i As Integer = 0

While dr.Read
i += 1
DataGridView1.Rows.Add(dr.Item("q_no").ToString, i,
dr.Item("course").ToString, dr.Item("subject").ToString,
dr.Item("question").ToString, dr.Item("op_A").ToString,
dr.Item("op_B").ToString, dr.Item("op_C").ToString,
43
dr.Item("op_D").ToString, dr.Item("answer").ToString) End
While
dr.Close()

con.Close()
lblcount.Text = "(" & DataGridView1.RowCount & ")
Records found."

End Sub

Private Sub PictureBox1_Click(sender As Object, e As


EventArgs) Handles PictureBox1.Click
Me.Dispose()

End Sub

Private Sub DataGridView1_CellContentClick(sender As


Object, e As DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
Dim colName As String =
DataGridView1.Columns(e.ColumnIndex).Name
If colName = "Column11" Then
With frmUpdateQuestion
_id =
DataGridView1.Rows(e.RowIndex).Cells(0).Value.ToString

.cmbCourse.Text =
DataGridView1.Rows(e.RowIndex).Cells(2).Value.ToString
.cmbSubject.Text =
44
DataGridView1.Rows(e.RowIndex).Cells(3).Value.ToString
.txtQno.Text = _id
.txtQus.Text =
DataGridView1.Rows(e.RowIndex).Cells(4).Value.ToString
.txtOptionA.Text =
DataGridView1.Rows(e.RowIndex).Cells(5).Value.ToString
.txtOptionB.Text =
DataGridView1.Rows(e.RowIndex).Cells(6).Value.ToString
.txtOptionC.Text =
DataGridView1.Rows(e.RowIndex).Cells(7).Value.ToString
.txtOptionD.Text =
DataGridView1.Rows(e.RowIndex).Cells(8).Value.ToString
.cmbcorrectAns.Text =
DataGridView1.Rows(e.RowIndex).Cells(9).Value.ToString
.txtQno.ReadOnly = True
.ShowDialog()

End With
ElseIf colName = "Column12" Then
If (MsgBox("Are you sure want to delete record?",
vbYesNo + vbQuestion) = vbYes) Then
qry = "Delete from tbl_Question where q_no=" &
DataGridView1.Rows(e.RowIndex).Cells(0).Value.ToString &
"" i=
InsertData(qry)
If (i > 0) Then
MsgBox("Question Deleted successful",
MsgBoxStyle.Information)
LoadRecord()
45
Else
MsgBox("Question not Deleted",
MsgBoxStyle.Exclamation)
End If

End If

End If
End Sub End
Class

FORM ADD EMPLOYEE


Imports System.Data
Imports System.Data.SqlClient

Public Class frmAddEmployee


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()

End Sub

Private Sub btnsubmit_Click(sender As Object, e As


EventArgs) Handles btnsubmit.Click
If con.State = 1 Then con.Close()

46
If txteno.Text = "" Or txtename.Text = "" Or txtaddrs.Text
= "" Or txtcntct.Text = "" Or (rdbmale.Checked = False And
rdbfemale.Checked = False) Or txtdesign.Text = "" Or
txtusername.Text = "" Or txtpswd.Text = "" Then
MsgBox("please enter all details")
Exit Sub
End If
If txtcntct.Text.Length < 10 Or txtcntct.Text.Length > 11
Then
MsgBox("invalid phone number")
Exit Sub
End If
Try
cmd = New SqlCommand("select emp_no from
tbl_Employee where emp_no=@d1 ", con)
Dim UParam As New SqlParameter("@d1",
Me.txteno.Text)
cmd.Parameters.Add(UParam)
cmd.Connection = con cmd.Connection.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader()
If dr.HasRows Then
MsgBox("EMPLOYEE NUMBER IS ALREADY
EXIST")
con.Close()
Else
'insert record
If con.State = 1 Then con.Close()
radiogender()
qry = "insert into

47
tbl_Employee(emp_no,emp_name,doj,dob,addr,contact,designat
ion,username,password,gender)values('" & txteno.Text & "','" &
txtename.Text & "','" & dtpdoj.Value & "','" & dtpdob.Value &
"','" & txtaddrs.Text & "','" & txtcntct.Text & "','" &
txtdesign.Text & "','" & txtusername.Text & "','" & txtpswd.Text
& "','" & gender & "')"
cmd = New SqlCommand(qry, con)
cmd.Connection = con cmd.Connection.Open()
i = cmd.ExecuteNonQuery()
If (i >= 1) Then
MsgBox("EMPLOYEE REGISTRATION
SUCCESSFULL")
con.Close()
Else
MsgBox("Registration Failed")
con.Close()

End If
reset()
End If

Catch ex As Exception
MsgBox(ex.Message)

End Try
End Sub
Private Sub frmAddEmployee_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
LOAD_EMPNO() txtename.Focus()
48
dtpdob.MaxDate = Today.AddYears(-20)
dtpdoj.MaxDate = Today.Date
End Sub
Public Sub LOAD_EMPNO()
ds.Clear()
txteno.Clear()
If con.State = 1 Then con.Close()

con.Open()
str = "select * from tbl_Employee"

cmd = New SqlCommand(str, con)


da.SelectCommand = cmd
da.Fill(ds, "tbl_Employee")

Dim LastNo As Integer


LastNo = ds.Tables("tbl_Employee").Rows.Count + 1
If LastNo >= 0 Then
txteno.Text = LastNo Else
txteno.Text = "1"
End If

If con.State = 1 Then con.Close()


End Sub

Public Sub radiogender()


If rdbfemale.Checked = True Then

49
gender = "Female"
Else
gender = "Male"
End If
End Sub
Private Sub txtcntct_KeyPress(sender As Object, e As
KeyPressEventArgs) Handles txtcntct.KeyPress
If Char.IsLetter(e.KeyChar) Then
e.Handled = True
End If
End Sub
Private Sub txtename_KeyPress(sender As Object, e As
KeyPressEventArgs) Handles txtename.KeyPress
If Char.IsNumber(e.KeyChar) Then
e.Handled = True
End If
End Sub

Private Sub txtdesign_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles txtdesign.KeyPress
If Char.IsNumber(e.KeyChar) Then
e.Handled = True
End If
End Sub

Private Sub btnreset_Click(sender As Object, e As


EventArgs) Handles btnreset.Click
reset()
End Sub Public
Sub reset()
50
txtename.Clear()
txtaddrs.Clear()
txtcntct.Clear()
txtdesign.Clear()
txtusername.Clear()
txtpswd.Clear()
LOAD_EMPNO()
End Sub

End Class

FORM VIEW EMPLOYEE DETAILS


Imports System.Data
Imports System.Data.SqlClient

Public Class frmEmployeeViewList


Dim itemcoll(20) As String
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub frmEmployeeViewList_Load(sender As Object, e


As EventArgs) Handles MyBase.Load
LoadEmp()
End Sub
Public Sub LoadEmp()
If con.State = 1 Then con.Close()
con.Open()
51
Me.ListView1.View = View.Details
Me.ListView1.GridLines = True

qry = "select * from tbl_Employee"


cmd = New SqlCommand(qry, con) da
= New SqlDataAdapter(cmd)
ds = New DataSet

da.Fill(ds, "Table")
Dim i As Integer = 0
Dim j As Integer = 0
'adding the column in listview
For i = 0 To ds.Tables(0).Columns.Count - 1
Me.ListView1.Columns.Add(ds.Tables(0).Columns(i).ColumnN
ame.ToString())

Next
' now adding the item in listview
For i = 0 To ds.Tables(0).Rows.Count - 1
For j = 0 To ds.Tables(0).Columns.Count - 1
itemcoll(j) = ds.Tables(0).Rows(i)(j).ToString()

Next
Dim lvi As New ListViewItem(itemcoll)
Me.ListView1.Items.Add(lvi)
Next

End Sub
End Class

52
FORM APPROVAL STUDENT
Imports System.Data
Imports System.Data.SqlClient

Public Class frmApprovalStudent


Private Sub frmApprovalStudent_Load(sender As Object, e
As EventArgs) Handles MyBase.Load
loadRecord()
End Sub
Public Sub loadRecord()
Dim i As Integer = 0 dgvApprove.Rows.Clear()
con.Open()
cmd = New SqlCommand("select * from tbl_registration
where approve not in ('yes')", con) dr =
cmd.ExecuteReader
While dr.Read
i += 1
dgvApprove.Rows.Add(dr.Item("studno").ToString, i,
dr.Item("studname").ToString, dr.Item("gender").ToString,
dr.Item("course").ToString, dr.Item("qualification").ToString,
dr.Item("dob").ToString, "yes")

End While
dr.Close()
con.Close()
lblcount.Text = "(" & dgvApprove.RowCount & ") Record
Found."
End Sub
53
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub dgvApprove_CellContentClick(sender As Object,


e As DataGridViewCellEventArgs) Handles
dgvApprove.CellContentClick
Dim colname As String =
dgvApprove.Columns(e.ColumnIndex).Name
If (colname = "Column8") Then
If (MsgBox("Are you Sure Want to Approve Student",
vbYesNo + vbQuestion) = vbYes) Then
con.Open()
cmd = New SqlCommand("Update tbl_registration set
approve = 'yes'where studno='" + _id + "'", con)
cmd.ExecuteNonQuery()

con.Close()
MsgBox("Student Approved Successfully",
vbInformation)
loadRecord()
End If
End If
End Sub

Private Sub dgvApprove_SelectionChanged(sender As

54
Object, e As EventArgs) Handles
dgvApprove.SelectionChanged i=
dgvApprove.CurrentRow.Index
_id = dgvApprove.Item(0, i).Value
End Sub
End Class
FORM STUDENT HISTORY
Imports System.Data
Imports System.Data.SqlClient

Public Class frmStudentHistory


Private Sub frmStudentHistory_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
loadApprovedStudent() loadNOTApprovedStudent()
End Sub
Public Sub loadApprovedStudent()
If con.State = 1 Then con.Close()
con.Open()

qry = "select studno as Application_no,studname as


[Student name],addr as [Address],gender as [Gender],course as
[Course],dob as [Date Of Birth],approve as [Approved] from
tbl_registration with (nolock) where approve='yes' "
ds = FetchData(qry)
If (ds.Tables(0).Rows.Count > 0) Then
dgvASL.DataSource = ds.Tables(0)
Else
MsgBox("Record not found", vbCritical)

End If
55
If con.State = 1 Then con.Close()

End Sub

Public Sub loadNOTApprovedStudent()


If con.State = 1 Then con.Close()
con.Open()

qry = "select studno as Application_no,studname as


[Student name],addr as [Address],gender as [Gender],course as
[Course],dob as [Date Of Birth],approve as [Approved] from
tbl_registration with (nolock) where approve='No' "
ds = FetchData(qry)
If (ds.Tables(0).Rows.Count > 0) Then
dgvNotA.DataSource = ds.Tables(0) Else
MsgBox("Record not found", vbCritical)

End If
If con.State = 1 Then con.Close()

End Sub

Private Sub Panel1_Paint(sender As Object, e As


PaintEventArgs) Handles Panel1.Paint

End Sub

Private Sub PictureBox1_Click(sender As Object, e As


EventArgs) Handles PictureBox1.Click
Me.Dispose()
56
End Sub
End Class
FORM ADD IMAGE
Imports System.Data.SqlClient

Public Class frmaddstudimg


Dim ofd As OpenFileDialog = New OpenFileDialog

Private Sub PictureBox2_Click(sender As Object, e As


EventArgs) Handles PictureBox2.Click
If ofd.ShowDialog = DialogResult.OK Then
PictureBox2.Image = Image.FromFile(ofd.FileName)
Else
MsgBox("Please select A file", MsgBoxStyle.Critical)
End If
End Sub

Private Sub btnAdd_Click(sender As Object, e As EventArgs)


Handles btnAdd.Click
If TextBox1.Text <> "" Then

Dim fname As String = TextBox1.Text & ".jpg"


Dim folder As String = "D:\pp"
qry = "update tbl_registration set imagefile =@img
where studno=@id"
con.Open()
Dim path As String = System.IO.Path.Combine(folder,
fname)

57
cmd = New SqlCommand(qry, con)
cmd.Parameters.AddWithValue("@img", path)
cmd.Parameters.AddWithValue("@id", TextBox1.Text)
cmd.ExecuteNonQuery()
con.Close()
Dim a As Image = PictureBox2.Image
a.Save(path)
MsgBox("Profile pic save successfully")

End If
End Sub

Private Sub PictureBox1_Click(sender As Object, e As


EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub Button1_Click(sender As Object, e As


EventArgs) Handles Button1.Click cmd = New
SqlCommand("select imagefile from tbl_registration where
studno='" & TextBox1.Text & "'", con) con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
If dr.Item("imagefile").ToString = "" Then
PictureBox2.Image = My.Resources.noimage_jpg
Else
PictureBox2.Image =
Image.FromFile(dr.Item("imagefile").ToString)

End If
58
Else
End If con.Close()
End Sub
End class
FORM FEES PAYMENT
Imports System.Data
Imports System.Data.SqlClient
Public Class frmFeesPayment
Dim regnum As String
Dim recptnum As Integer
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()

End Sub

Private Sub txtrollno_TextChanged(sender As Object, e As


EventArgs) Handles txtrollno.TextChanged
If txtrollno.Text <> "" Then
qry = "select course,fees from tbl_fees where studno='"
& txtrollno.Text & "'"
If con.State = 1 Then con.Close()
Try
cmd = New SqlCommand(qry, con)
con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
MsgBox("payment Already done",
59
MsgBoxStyle.Exclamation)
lblcourse.Text = dr.Item("course").ToString
lblfees.Text = dr.Item("fees").ToString
CheckBox1.Checked = True
Else
qry = "select course from tbl_registration where
studno='" & txtrollno.Text & "'"
Try
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
lblcourse.Text = dr.Item("course").ToString
Else
lblcourse.Text = ""
lblfees.Text = ""
CheckBox1.Checked = False
MsgBox("Application Number is not found",
MsgBoxStyle.Critical)
Exit Sub

End If

Catch ex As Exception
MsgBox(ex.Message)
End Try
'select fees
If con.State = 1 Then con.Close()
qry = "select fees from tbl_course_fee where
60
course='" & lblcourse.Text & "' "
cmd = New SqlCommand(qry, con)
con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
lblfees.Text = dr.Item("fees").ToString
CheckBox1.Checked = False
End If
End If

Catch ex As Exception
MsgBox(ex.Message)

End Try
End If
If con.State = 1 Then con.Close()
End Sub

Private Sub btnok_Click(sender As Object, e As EventArgs)


Handles btnok.Click
'validation

If txtrollno.Text = "" Or lblcourse.Text = "" Or lblfees.Text


= "" Or CheckBox1.Checked = False Then
MsgBox("Plz Enter The Required Details",
MsgBoxStyle.Critical)
Else
qry = "select max(CAST(SUBSTRING
(Ex_regno,2,Len(Ex_regno))+1 as int)) as roll from tbl_approve
61
"
If con.State = 1 Then con.Close()

cmd = New SqlCommand(qry, con)


con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
If Val(dr.Item("roll").ToString) = 0 Then
regnum = "R1917609"
Else
regnum = "R" & dr.Item("roll").ToString
End If
End If
'insert

qry = "insert into


tbl_approve(studno,Ex_regno,course)values('" & txtrollno.Text
& "','" & regnum & "','" & lblcourse.Text & "')"
InsertData(qry)
qry = "select max(recpt_no)+1 as recpt_no from
tbl_fees"
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
If Val(dr.Item("recpt_no").ToString) = 0 Then
recptnum = 1001 Else
recptnum = Val(dr.Item("recpt_no").ToString)
End If
62
End If
Try
qry = "insert into
tbl_fees(recpt_no,studno,course,fees)values('" & recptnum &
"','" & txtrollno.Text & "','" & lblcourse.Text & "','" &
lblfees.Text & "')"

i = InsertData(qry)
If i > 0 Then
MsgBox("Payment Successfully Done",
MsgBoxStyle.Information)
Else
MsgBox("Payment Failed", MsgBoxStyle.Critical)
End If

Catch ex As Exception
MsgBox(ex.Message)

End Try
End If
End Sub
Private Sub btncancle_Click(sender As Object, e As
EventArgs) Handles btncancle.Click
txtrollno.Clear() lblcourse.Text
= ""
lblfees.Text = ""
CheckBox1.Checked = False
End Sub
End class
63
FORM FEES DETAILS
Imports System.Data
Imports System.Data.SqlClient

Public Class frmFeesPaymentDatails


Private Sub frmFeesPaymentDatails_Load(sender As Object,
e As EventArgs) Handles MyBase.Load
loadApprovedStudent()
End Sub
Public Sub loadApprovedStudent()
If con.State = 1 Then con.Close()
con.Open()

qry = "select f .recpt_no ,f.studno,f.course,f.fees,f.pdate


From tbl_fees f join tbl_registration r On r .studno =f.studno
where r.approve ='yes' "

ds = FetchData(qry)
If (ds.Tables(0).Rows.Count > 0) Then
dgvASL.DataSource = ds.Tables(0)
Else
MsgBox("Record not found", vbCritical)

End If
If con.State = 1 Then con.Close()

End Sub

64
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As


EventArgs) Handles TextBox1.TextChanged
If Val(TextBox1.Text.Trim()) > 0 Then
loadfeesbyid()
ElseIf (Val(TextBox1.Text.Trim()) = 0) Then

loadApprovedStudent()

ElseIf TextBox1.Text.Trim() = String.Empty Then


loadApprovedStudent()
End If

loadfeesbyid()
End Sub
Public Sub loadfeesbyid()
If con.State = 1 Then con.Close()
con.Open()

qry = "set nocount on select f.recpt_no


,f.studno,f.course,f.fees,f.pdate From tbl_fees f with (nolock)
join tbl_registration r On r .studno =f.studno where r.approve
='yes'and f.studno='" & Convert.ToDouble(TextBox1.Text) &
"'"
ds = FetchData(qry)
If (ds.Tables(0).Rows.Count > 0) Then
65
dgvASL.DataSource = ds.Tables(0)
Else
MsgBox("Record not found", vbCritical)

End If
If con.State = 1 Then con.Close()

End Sub

Private Sub TextBox1_KeyPress(sender As Object, e As


KeyPressEventArgs) Handles TextBox1.KeyPress
If Char.IsLetter(e.KeyChar) Then
e.Handled = True
End If
End Sub
End Class
FORM EXAM CHANGE PASSWORD
Imports System.Data.SqlClient

Public Class frmExamPasschange


Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()

End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As


LinkLabelLinkClickedEventArgs) Handles
LinkLabel1.LinkClicked
66
If LinkLabel1.Text = "show password" Then
txtNEWpass.UseSystemPasswordChar = False
txtConfirmpass.UseSystemPasswordChar = False
LinkLabel1.Text = "Hide"
ElseIf LinkLabel1.Text = "Hide" Then
txtNEWpass.UseSystemPasswordChar = True
txtConfirmpass.UseSystemPasswordChar = True
LinkLabel1.Text = "show password"

End If
End Sub

Private Sub frmExamPasschange_Load(sender As Object, e


As EventArgs) Handles MyBase.Load
LinkLabel1.Text = "show password"
End Sub

Private Sub btnUpdate_Click(sender As Object, e As


EventArgs) Handles btnUpdate.Click
If con.State = 1 Then con.Close()

If txtAdminpass.Text = "" Then Exit Sub


If txtConfirmpass.Text = "" Then Exit Sub
If txtOldpass.Text = "" Then Exit Sub
If txtNEWpass.Text = "" Then Exit Sub

If txtAdminpass.Text <> Module1.userpass And


Module1.utype <> "Admin" Then
MsgBox("Invallid Admin Password,You Do Not have

67
Permission")
txtAdminpass.Text = ""
txtConfirmpass.Text = ""
txtOldpass.Text = "" txtNEWpass.Text
= ""
txtAdminpass.Focus()

Else
qry = "select * from tblpassword where password='" &
txtOldpass.Text & "'"
con.Open()
cmd = New SqlCommand(qry, con)
dr = cmd.ExecuteReader
If dr.Read() Then
If txtNEWpass.Text <> txtConfirmpass.Text Then
MsgBox("Please Confirm the password correct")
txtNEWpass.Clear() txtConfirmpass.Clear()
txtNEWpass.Focus()
Else
qry = ("Update tblpassword set password='" &
txtNEWpass.Text & "'")
InsertData(qry)
MsgBox("Password Changed Sucessfully")
clr()
End If
Else
MsgBox("Invalid Old Exam password",
MsgBoxStyle.Critical)
txtOldpass.Clear()
txtOldpass.Focus()
68
End If
End If
con.Close()

End Sub Public Sub clr()


txtAdminpass.Text = ""
txtConfirmpass.Text = ""
txtOldpass.Text = ""
txtNEWpass.Text = ""
End Sub End
Class

FORM EXAM ADD PASSWORD


Public Class frmPassword
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub btnSubmit_Click(sender As Object, e As


EventArgs) Handles btnSubmit.Click
If txtNEWExamPass.Text <> "" Then
qry = "delete from tblpassword"
InsertData(qry)
qry = "insert into tblpassword (password) values('" &
txtNEWExamPass.Text & "')"
InsertData(qry)
MsgBox("password saved successfully",
69
MsgBoxStyle.Information)
txtNEWExamPass.Clear()

End If
End Sub End
Class

FORM READY EXAM


Imports System.Data.SqlClient
Public Class frmreadyexam
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub

Private Sub frmreadyexam_Load(sender As Object, e As


EventArgs) Handles MyBase.Load
If con.State = 1 Then con.Close()
cmbsubject1.Enabled = True txtcourse.Text = course
Bindsubject()
StuExNo()
End Sub
Private Sub Bindsubject() '-----------show all subject in
comboBox
cmbsubject1.Items.Clear()
ds.Clear()
If con.State = 1 Then con.Close()
qry = "select distinct (subjects) from tbl_course with
(nolock) where course='" & txtcourse.Text & "' "
ds = FetchData(qry)
70
If ds.Tables(0).Rows.Count > 0 Then
Dim tblrow As Integer = ds.Tables(0).Rows.Count - 1
Dim i As Integer = 0
For i = 0 To tblrow

cmbsubject1.Items.Add(ds.Tables(0).Rows(i)(0).ToString())
Next
Else

cmbsubject1.Enabled = False
End If
End Sub

Private Sub btnGO_Click(sender As Object, e As EventArgs)


Handles btnGO.Click
If txtcourse.Text = "" Then
Exit Sub
ElseIf txtexampass.Text = "" Then
Exit Sub
ElseIf cmbsubject1.Text = "" Then
Exit Sub
End If
subject = cmbsubject1.Text
qry = "select password from tblpassword where
password='" & txtexampass.Text & "' "
Try
If con.State = 1 Then con.Close()

71
cmd = New SqlCommand(qry, con)
con.Open()
Dim dr1 As SqlDataReader = cmd.ExecuteReader()
If dr1.Read() Then
'show exam start
Me.Close()
frmExamTest.Show()

Else
MsgBox("Record not found try again")
End If
Catch ex As Exception
MsgBox(ex.Message)

End Try
End Sub

Public Sub StuExNo()


qry = "select * from tbl_approve with (nolock) where
studno= '" & roll1 & "' "
Try
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
Dim dr1 As SqlDataReader = cmd.ExecuteReader()
If dr1.Read() Then
rg = dr1.Item("Ex_regno").ToString
Else
MsgBox("Record not found try again")
btnGO.Enabled = False
72
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message)

End Try
If con.State = 1 Then con.Close()
End Sub End
Class

FORM EXAM TEST


Imports System.Data
Imports System.Data.SqlClient
Public Class frmExamTest
Dim d, diff As TimeSpan
Dim d2 As DateTime
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()
End Sub
Private Sub btnNext_Click(sender As Object, e As EventArgs)
Handles btnNext.Click
If con.State = 1 Then con.Close()
If (rdboA.Checked = False And rdboB.Checked = False
And rdboC.Checked = False And rdboD.Checked = False) Then
MsgBox("plz give the answer.....select any option",
73
MsgBoxStyle.Exclamation)
Exit Sub Else qnum = qnum + 1 qry
= "select max(q_no)as q_no from tbl_Question with (nolock)
where course='" & lblcoursename.Text & "'and subject='" &
subject & "'" cmd = New SqlCommand(qry, con)
con.Open()
Dim dr1 As SqlDataReader = cmd.ExecuteReader()
If dr1.Read Then
If qnum <= dr1.Item("q_no").ToString Then
lblqstn.Text = qnum
Else
btnNext.Enabled = False
MsgBox("this is last question",
MsgBoxStyle.Exclamation)
End If
End If
End If
If con.State = 1 Then con.Close()
End Sub
Private Sub lblqstn_TextChanged(sender As Object, e As
EventArgs) Handles lblqstn.TextChanged
If lblqstn.Text <> "" Then

74
qry = "select
q_no,question,op_A,op_B,op_C,op_D,answer from tbl_Question
where course='" & lblcoursename.Text & "'and subject='" &
lblsubject.Text & "' and q_no= '" & lblqstn.Text &
"'"
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
Dim dr1 As SqlDataReader = cmd.ExecuteReader()
If dr1.Read Then
txtqstn.Text = dr1.Item("question").ToString
rdboA.Text = dr1.Item("op_A").ToString
rdboB.Text = dr1.Item("op_B").ToString rdboC.Text
= dr1.Item("op_C").ToString rdboD.Text =
dr1.Item("op_D").ToString lblAns.Text =
dr1.Item("answer").ToString

qnum = lblqstn.Text
rdboA.Checked = False
rdboB.Checked = False
rdboC.Checked = False
rdboD.Checked = False End If
qry = "select answer from tbl_studentanswers where
75
Ex_regno='" & rg & "'and course='" & lblcoursename.Text &
"'and subject='" & lblsubject.Text & "'and q_no='" &
lblqstn.Text & "'"
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
dr1 = cmd.ExecuteReader()
If dr1.Read Then
If dr1.Item("answer").ToString = "A" Then
rdboA.Checked = True
ElseIf dr1.Item("answer").ToString = "B" Then
rdboB.Checked = True
ElseIf dr1.Item("answer").ToString = "C" Then
rdboC.Checked = True
ElseIf dr1.Item("answer").ToString = "D" Then
rdboD.Checked = True

End If
End If
If qnum <> 0 Then qry = "select max(q_no)
as q_no from tbl_Question where course='" &
lblcoursename.Text & "'and subject='" & lblsubject.Text &
"'"

76
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
dr1 = cmd.ExecuteReader()
If dr1.Read Then
If
IsDBNull(Convert.ToInt32(dr1.Item("q_no").ToString)) = False
Then
If qnum <= dr1.Item("q_no").ToString Then
btnNext.Enabled = True Else
btnNext.Enabled = False
btnpreview.Enabled = True
End If
End If
End If

qry = "select min(q_no)as q_no from tbl_Question


where course='" & lblcoursename.Text & "'and subject='" &
lblsubject.Text & "'"
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open()
dr1 = cmd.ExecuteReader()
77
If dr1.Read Then
If
IsDBNull(Convert.ToInt32(dr1.Item("q_no").ToString)) = False
Then
If qnum <= dr1.Item("q_no").ToString Then
btnpreview.Enabled = False Else
btnpreview.Enabled = True
End If
End If
End If
End If
End If
End Sub

Private Sub btnpreview_Click(sender As Object, e As


EventArgs) Handles btnpreview.Click
qnum = lblqstn.Text qnum =
qnum - 1 If qnum >= 1 Then
lblqstn.Text = qnum Else
btnpreview.Enabled = False
End If
End Sub

78
Private Sub rdboA_CheckedChanged(sender As Object, e As
EventArgs) Handles rdboA.CheckedChanged
If rdboA.Checked = True Then
answer() 'delete duplicate
qry = "delete from tbl_studentanswers where
Ex_regno='" & rg & "'and course='" & lblcoursename.Text &
"'and subject='" & lblsubject.Text & "'and q_no='" &
lblqstn.Text & "'"
InsertData(qry)
'insert
qry = "insert into
tbl_studentanswers(Ex_regno,course,subject,q_no,answer,crc_a
ns)values('" & rg & "','" & lblcoursename.Text & "','" &
lblsubject.Text & "','" & lblqstn.Text & "','" & ans & "','" &
lblAns.Text & "')"
InsertData(qry)
End If
End Sub
Public Sub answer()
If rdboA.Checked = True Then
ans = "A"
ElseIf rdboB.Checked = True Then
ans = "B"

79
ElseIf rdboC.Checked = True Then
ans = "C"
ElseIf rdboD.Checked = True Then
ans = "D"
Else
MsgBox("Please Answer to Question",
MsgBoxStyle.Exclamation)
End If
End Sub
Private Sub rdboB_CheckedChanged(sender As Object, e As
EventArgs) Handles rdboB.CheckedChanged
If rdboB.Checked = True Then
answer() 'delete duplicate
qry = "delete from tbl_studentanswers where
Ex_regno='" & rg & "'and course='" & lblcoursename.Text &
"'and subject='" & lblsubject.Text & "'and q_no='" &
lblqstn.Text & "'"
InsertData(qry)
'insert
qry = "insert into
tbl_studentanswers(Ex_regno,course,subject,q_no,answer,crc_a
ns)values('" & rg & "','" & lblcoursename.Text & "','" &
lblsubject.Text & "','" & lblqstn.Text & "','" & ans & "','" &
lblAns.Text & "')"
80
InsertData(qry)
End If
End Sub
Private Sub rdboC_CheckedChanged(sender As Object, e As
EventArgs) Handles rdboC.CheckedChanged
If rdboC.Checked = True Then
answer() 'delete duplicate
qry = "delete from tbl_studentanswers where
Ex_regno='" & rg & "'and course='" & lblcoursename.Text &
"'and subject='" & lblsubject.Text & "'and q_no='" &
lblqstn.Text & "'"
InsertData(qry)
'insert
qry = "insert into
tbl_studentanswers(Ex_regno,course,subject,q_no,answer,crc_a
ns)values('" & rg & "','" & lblcoursename.Text & "','" &
lblsubject.Text & "','" & lblqstn.Text & "','" & ans & "','" &
lblAns.Text & "')"
InsertData(qry)
End If
End Sub
Private Sub rdboD_CheckedChanged(sender As Object, e As

81
EventArgs) Handles rdboD.CheckedChanged
If rdboD.Checked = True Then
answer() 'delete duplicate
qry = "delete from tbl_studentanswers where
Ex_regno='" & rg & "'and course='" & lblcoursename.Text &
"'and subject='" & lblsubject.Text & "'and q_no='" &
lblqstn.Text & "'"
InsertData(qry)
'insert
qry = "insert into
tbl_studentanswers(Ex_regno,course,subject,q_no,answer,crc_a
ns)values('" & rg & "','" & lblcoursename.Text & "','" &
lblsubject.Text & "','" & lblqstn.Text & "','" & ans & "','" &
lblAns.Text & "')"
InsertData(qry)
End If
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs)


Handles Timer1.Tick
lbltime1.Text = String.Format("{0:T}",
System.DateTime.Now)
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs)

82
Handles Timer2.Tick d2
= Now If d2 > d1 Then
frmExamResult.Show()
Me.Close()
Timer2.Enabled = False
Timer2.Stop()
End If
End Sub
Private Sub btnSubmit_Click(sender As Object, e As
EventArgs) Handles btnSubmit.Click
Me.Dispose() frmExamResult.Show()
End Sub

Private Sub frmExamTest_Load(sender As Object, e As


EventArgs) Handles MyBase.Load d1 =
Now.AddSeconds(200) If con.State = 1 Then con.Close()
qry = "select course from tbl_approve where Ex_regno='" &
rg & "'"

Try
cmd = New SqlCommand(qry, con)
con.Open()

83
Dim dr1 As SqlDataReader = cmd.ExecuteReader()
If dr1.Read() Then lblcoursename.Text =
dr1.Item("course").ToString course =
lblcoursename.Text
End If
If con.State = 1 Then con.Close() qry = "select
subjects from tbl_course where course='" & lblcoursename.Text
& "'and subjects='" & subject & "'and part='" & p & "'"
cmd = New SqlCommand(qry, con) con.Open()
dr1 = cmd.ExecuteReader()
If dr1.Read() Then lblsubject.Text =
dr1.Item("subjects").ToString subject =
lblsubject.Text
End If
If con.State = 1 Then con.Close()
'show question
qry = "select
q_no,question,op_A,op_B,op_C,op_D,answer from tbl_Question
with (nolock) where course='" &
lblcoursename.Text & "'and subject ='" & lblsubject.Text & "' "
cmd = New SqlCommand(qry, con) con.Open()
dr1 = cmd.ExecuteReader()

84
If dr1.Read() Then lblqstn.Text =
dr1.Item("q_no").ToString txtqstn.Text =
dr1.Item("question").ToString rdboA.Text =
dr1.Item("op_A").ToString rdboB.Text =
dr1.Item("op_B").ToString rdboC.Text =
dr1.Item("op_C").ToString rdboD.Text =
dr1.Item("op_D").ToString lblAns.Text =
dr1.Item("answer").ToString qnum = lblqstn.Text
lblstdname.Text = Module1.name1 lblrollno.Text =
Module1.roll1
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
If con.State = 1 Then con.Close()
End Sub
End Class

FORM EXAM RESULT


Imports System.Data.SqlClient

Public Class frmExamResult


85
Private Sub PictureBox1_Click(sender As Object, e As
EventArgs) Handles PictureBox1.Click
Me.Dispose()

End Sub
Private Sub frmExamResult_Load(sender As Object, e As
EventArgs) Handles MyBase.Load
lblRegno.Text = rg lblCourse.Text
= course lblSubject.Text = subject
If con.State = 1 Then con.Close()

qry = "select count(*) as aa from tbl_studentanswers where


answer=crc_ans and Ex_regno='" & lblRegno.Text & "'and
course='" & lblCourse.Text & "'and subject='" & lblSubject.Text
& "' "
cmd = New SqlCommand(qry, con)
con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
lblC.Text = dr.Item("aa").ToString

End If
'total Question

qry = "select count(*) as totq from tbl_studentanswers


where course='" & lblCourse.Text & "' and subject='" &
lblSubject.Text & "' " cmd = New SqlCommand(qry,
con)
If con.State = 1 Then con.Close()

86
con.Open()
dr = cmd.ExecuteReader()
If dr.Read Then
lblTotal.Text = dr.Item("totq").ToString
End If

lblPercentage.Text = (Val(lblC.Text) * 100) /


Val(lblTotal.Text)

If Val(lblPercentage.Text) < 35 Then

lblCount.Text = "Fail"
lblStatus.Text = "Fail"
ElseIf Val(lblPercentage.Text) < 50 Then
lblStatus.Text = "Pass By 2nd Division" ElseIf
Val(lblPercentage.Text) < 90 Then
lblCount.Text = "Pass By First Division"
lblStatus.Text = "First division"
ElseIf Val(lblPercentage.Text) >= 90 Then lblCount.Text
= "Super performance pass by First Division"
lblStatus.Text = "Outstanding"
End If
qry = "insert into
tbl_results(Ex_regno,course,subject,total_qstn,correct_qstn,perc,
status)values('" & lblRegno.Text & "','" & lblCourse.Text & "','"
& lblSubject.Text & "','" & lblTotal.Text & "','" & lblC.Text &
"','" & lblPercentage.Text & "','" & lblStatus.text & "')" i
= InsertData(qry)
If i > 0 Then
MsgBox("This your Report card",
87
MsgBoxStyle.Information)
Else
End If

End Sub
Private Sub btnNext_Click(sender As Object, e As
EventArgs) Handles btnNext.Click
lblCourse.Text = ""
lblC.Text = "" lblTotal.Text
= "" lblStatus.Text = ""
lblSubject.Text = ""
lblRegno.Text = ""
lblPercentage.Text = ""
frmLogin.Show()
Me.Close()
End Sub
End Class
MODULE
Imports System.Data
Imports System.Data.SqlClient
Module Module1
Public cmd As New SqlCommand
Public dr As SqlDataReader
Public da As New SqlDataAdapter
Public strUser As String = "priya"
Public connectionstring As String = "Data Source=.;Initial
Catalog=DBExaminationSystem;Integrated Security=True"
Public con As New SqlConnection(connectionstring)

88
Public i As Integer = 0
Public name1 As String = ""
Public utype As String = ""
Public userpass As String = ""
Public str, gender As String
Public ds As New DataSet
Public qry As String = ""
Public _id As String
Public roll1 As String = ""
Public rg As String = ""
Public course, ans As String
Public subject As String = ""
Public p As Integer = 1
Public qnum As Integer
Public d1 As DateTime
Public Function FetchData(ByVal qry As String) As DataSet
da = New SqlDataAdapter(qry, con) ds = New DataSet
da.Fill(ds) Return ds
End Function
'create a function for insert,next and update
Public Function InsertData(ByVal qry As String) As Integer
If con.State = 1 Then con.Close()
cmd = New SqlCommand(qry, con)
con.Open() i=
cmd.ExecuteNonQuery() If
con.State = 1 Then con.Close()
Return i
End Function
End Module
89
8.OUTPUTS

FORM 1

LOGIN FORM

90
FORM MASTER

FORM ADD COURSE

91
FORM ADD QUESTION

FORM VIEW QUESTION

92
FORM ADD STAFF

FORM VIEW STAFF

93
FORM STUDENT APPROVAL

FORM STUDENT HISTORY

94
FORM STUDENT ADD IMAGE

FORM PAY EXAM FEE

95
FORM VIEW EXAM FEES

FORM CHANGE EXAM PASSWORD

96
FORM STUDENT REGISTRATION

FORM FEES DETAILS

97
FORM STUDENT INFO FOR EXAM

FORM FOR SELECT EXAM DETAILS

98
FORM QUESTION PAPER

FORM EXAM RESULT

99
9.TESTING
TESTING METHODOLOGIES
In software development project ,errors can be injected at
any stage during the development. For each phase there are
different techniques for detecting and eliminating errors
that originate in that phase. However, some requirements
errors and design errors are likely to remain undetected.
Ultimately,this error will be reflected in the code. Since
code is frequently the only product that can be executed and
whose actual behavior can be observed, testing is the phase
where the errors remaining from the earlier phase also must
be detected.
Hence testing perform savery critical role for quality
assurance and for insuring there liability of so
OBJECTIVE OF TESTING:
Software testing is a critical element of software quality
assurance and represents the ultimate review of
specification,design,coding.The engineer creates a serious
of test cases that are in tended to"demo lish"the software
that has been built.In fact, testing is the one step in this
software engineering process that could be viewed as
destructive rather than constructive.

100
The aim of any software development is to create bug free
reliable and secured system that provides solution to user
requirements. The implementation of a newly designed
application is imported in adopting a successful new
system.
The implementation of the application involved testing and
user training, acceptance and change over.
System testing is the process of checking if the developed
system is working according to the original objectives and
requirements. Initially the system was tested
experimentally with the test data so as to ensure that
software works according to the required specifications and
in the way user expect it to.
The objective of testing is as follows:
Testing is the process of executing a program with the
intent of an error.
A good tester case is one that has a high probability of
finding an undiscovered error.
A successful test is one that uncovers an as yet
undiscovered error.
System testing is the stage of implementation, which is
aimed at ensuring that works accurately and system
efficiently before line operation commences. Testing is
vital to the success of the system. System testing makes a
101
logical assumption that if all parts of the system are correct
the goal will be successfully achieved.
The candidate system is subject to a variety of tests-on-line
responses, volume, stress, recovery, security and usability
tests. A series of tests are performed before the system is
ready for user acceptance testing.
TYPES OF TESTING:
The testing process is divided into three major components
as follows:
•Unit testing
•Integration testing
•Validation testing
UNIT TESTING:
It focuses verification effort on the smallest unit of software
design module. Here using unit test plane prepared in
design description as guide, important control paths are
tested to uncover error within the boundary of the module.
Here at the first Ensure that the information properly flows
in to and out of the unit under the test. The data structure is
examined to ensure that the data stored temporarily
maintains its integrity during all steps in the algorithm
execution.

102
Boundary condition is tested to ensure the modules operate
properly at boundaries established to limit or restrict
processing. All paths in the control structure are exercised
to module, interface is tested to ensure all statements in a
module are executed at least once and finally all
errorshandling paths are tested to see messages are
intelligent, corresponds to errors encountered. And it
providers enough description to assist in the location of the
cause of the error. The test is carried out during the
programming and each module is found to be working
satisfactorily. When an unregistered user gives id and
password the system give the message like this.
INTEGRATION TESTING:
Here the focus of the test Is on the design and construction
of the software architecture. This is a systematic technique
for constructing the program structure and conducting tests
to uncover errors associated with interfacing. Here the
objective is to take unit-testing modules and build a
program that is dictated by design. All the functions were
integrated after successful completion of development and
unit testing. A comprehensive integrated testing was
carried out using integrated test plans in the design phase
of the system development as a guide to ensure the
following things like behavior of function with live data,
interface testing and performance testing.

103
The need for the integrated testing is to find the overall
system performance. The objective is to take unit tested
modules and build a program structure. The entire module
are combined and tested as a whole.The correction is
difficult because the vast expenses of entire program
complete the isolation of causes. Unit testing has applied to
Plantation Management System at the programming stage
and the errors found have been corrected, to maximize the
output. Black box testing is done to find
•In correct or missing function
• Interface errors
• Errors in external database access
• Performance errors
•Initialization and termination errors
The above testing was successfully carried out for these
applications according to the user requirement
specification. The database connection errors and the
accuracy with which data is stored, searched and retrieved
are tested with Corporate Recruitment System.
VALIDATION TESTING:
A the culmination of Integration Testing, software is
completely assembled as an application; interfacing errors
have been uncovered and corrected and a final series of
software test validation test begins.
104
Validation succeeds when the software functions in a
manner that can be reasonably expected by the user.
Software validation is achieved through a series of black
box tests that demonstrate confirm with requirements.
The performance characteristics confer to specification and
accepted .
A deviation form specification is uncovered and deficiency
list is created. Deviation or errors discovered at the step in
this system with the help of users by negotiating to
establish a meeting for resolving difference. This proposed
system under consideration was tested by validation and
found to be working satisfactorily.

OUTPUT TESTING:
After performing the validation testing. The next step is
output testing of the proposed system, since no system
could be useful if it does not produce the required output in
the required format.
Hence the output format is considered in two ways: one is
on the screen and another Sprinted format. The output
format on the screen is found to be correct as the format
was designed in the system design phase according to the
user needs.

105
For the hard copy too, the output comes out as specified by
the user. Hence output testing did not result in any
correction in the system.

106
10. CONCLUSION
Conclusion The offline examination system provides
better functionality for an examination to be more
efficient and reduce manual paperwork in order to
automate all possible tasks. For implementing this
system, visual studio (.net framework) and Microsoft Sql
server are used.

107
11.BIBLIOGRAPHY

Visual basic: https://www.geeksforgeeks.org/introduction-to-


visualstudio
.NET Framework: https://www.javatpoint.com/net-framework
https://www.youtube.com/watch?v=AJpTbPasJqI&list=PLS1QulW
o1RIYLpgVN_CpXbkOQoYJTItzg
Microsoft Sql server management:
https://www.youtube.com/watch?v=RSlqWnP-Dy8

108

You might also like