You are on page 1of 88

QUIZ MANAGEMENT SYSTEM

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 1
QUIZ MANAGEMENT SYSTEM

Course: Object Oriented Programming

Project on: Quiz Management System

Submitted To:

Sir Zeeshan Khawer

Submitted By:

Maryam Shehzadi F08 MD 148

Rabia Zaheer F08 MD 024

Fawad Mirza F07 MD 055

Ismail Fayyaz F08 MD 034

Muhammad Ali F08 MD 035

Salman Akmal F08 MD 043

Table of Contents
Introduction.......................................................................................................................................................................... 1
Modules and Coding ......................................................................................................................................... 2
Quiz Management System Form ..................................................................................................... 2
Welcome Form ....................................................................................................................................... 4
MDI Parent Form................................................................................................................................... 7

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 2
QUIZ MANAGEMENT SYSTEM

Starting Windows Form ................................................................................................................... 11


Create Login Form ............................................................................................................................. 13
Online Quiz Sheet Form .................................................................................................................... 17
Password Recovery Form................................................................................................................ 26
Log Out Form ........................................................................................................................................ 30
Shut Down Loading Form ................................................................................................................ 32
Starting Admin Window Screen Form ....................................................................................... 34
Change admin Info Form ................................................................................................................. 36
Create Quiz Form ................................................................................................................................ 39
Add Question Form ............................................................................................................................ 42
Google Search Form ........................................................................................................................... 54
Delete Student Login Form ............................................................................................................. 55
Edit Question Form ............................................................................................................................ 56
Reports................................................................................................................................................................... 62
Paper Show Report ............................................................................................................................ 62
Answer Sheet Report ......................................................................................................................... 64
Student Result Database Form ...................................................................................................... 65
Student Solved Sheet Form ............................................................................................................. 67
Marks Sheet Form ............................................................................................................................... 69
Access Database Records ............................................................................................................................. 71
Add Question in Database ................................................................................................................. 71
Answer Sheet Database .................................................................................................................... 72
Old Quiz Solved Sheet Database .................................................................................................... 73
Create Quiz Title.................................................................................................................................... 74
Login Database ...................................................................................................................................... 75
Marks Sheet Database......................................................................................................................... 76
Old Quizes Marks Sheet Database ................................................................................................. 77
Conclusion ........................................................................................................................................................................... 78

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 3
QUIZ MANAGEMENT SYSTEM

INTRODUCTION:

This project is about ONLINE QUIZ SYSTEM which provides the facility to both Teachers and Students. Teachers have a

separate login system to generate quiz according to subject. A program has a facility to Insert questions in quiz along

with different functionalities like update quiz, view quiz, select quiz and delete quiz. There is also a separate

Administrative Login provided to teachers so that students can’t cheat by entering into teacher’s login and getting the

quizzes. Students have separate section for login, and take quiz. After taking quizzes the program will check the quizzes,

generate marks and view reports.

For entering into whole process there is a system of Login where students and teachers give their ID and password. If

there is a new user in process the program also have a facility to register a new student. Besides that system also checks

either password is accurate or not and it does also provides facility to recover password in case of loose your password

and to change the existing password. Along with all this, there are different types of exception handling, security and

search modules are made to make the program more convenient and user friendly.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 4
QUIZ MANAGEMENT SYSTEM

Class Code

//INTERFCES//

interface Marks_Evaluation_Criteria
{
decimal count();
}
interface System_Database
{
void selection(string query, string tablename);
void insert(string query);
void update(string query);
void delete(string query);

//INHERITENCE INTERFACE//

interface Exception_handling:System_Database
{
int loginerrorchek(string a, string b, string c);
int passrecoveryerrorchek1(string b);
int passrecoveryerrorchek2(string a, string b);
int adminpasschangeerror(string b);
int studentpasschangeerror(string b);
int deleteloginerrorchk(string b);
int viewquestionerorchek(string b);
int editquestionerrorchek(string b);
}

//CLASSES INHERITENCE WITH OVERRIDING PLUS POLIMORPHISAM//

public class obtainmarks :Marks_Evaluation_Criteria


{
public decimal om;
public decimal m;
public static decimal increament = 1;
public static decimal increament1 = 1;

public virtual decimal count()

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 5
QUIZ MANAGEMENT SYSTEM

{
om = om + increament;
return om;
}
}
public class maxmarks : obtainmarks
{

public override decimal count()


{
m = m + increament1;
return m;
}

//CLASSES//

public class quizsystem:Exception_handling


{

//FOLLOWING ARE THE OBJECTS OF THE CLASS//

public string[] questions = new string[12];


public int q;
public string pass;
string connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=quizsystem2000.mdb";
public OleDbConnection conn = new OleDbConnection();
public OleDbDataAdapter dataadapter = new OleDbDataAdapter();
public DataSet dataset = new DataSet();
public OleDbCommand command = new OleDbCommand();

//CONSTRUCTOR FUNCTION//

public quizsystem()
{
conn.ConnectionString = connection;
conn.Open();
}

//INSERT, UPDATE,DELETE METHODS//

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 6
QUIZ MANAGEMENT SYSTEM

public void selection(string query, string tablename)


{
dataadapter = new OleDbDataAdapter(query, conn);
dataadapter.Fill(dataset, tablename);
}
public void insert(string query)
{
command = new OleDbCommand(query, conn);
command.ExecuteNonQuery();
}
public void update(string query)
{
command = new OleDbCommand(query, conn);
command.ExecuteNonQuery();
}
public void delete(string query)
{
command = new OleDbCommand(query, conn);
command.ExecuteNonQuery();
}

//SIMPLE METHODS//

public int loginerrorchek(string a, string b, string c)


{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["name"]) == a || Convert.ToString(row["pass"]) == a || Convert.ToString(row["occu"]) == c)
{
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["login"].Rows.Count)
{
ans = 0;
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 7
QUIZ MANAGEMENT SYSTEM

return ans;
}

public int passrecoveryerrorchek1(string b)


{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["name"]) == b)
{
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["login"].Rows.Count)
{
ans = 0;
}
return ans;
}
public int passrecoveryerrorchek2(string a,string b)
{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["sq"]) == a || Convert.ToString(row["ans"])==b )
{
pass = Convert.ToString(row["pass"]);
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["login"].Rows.Count)
{
ans = 0;

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 8
QUIZ MANAGEMENT SYSTEM

}
return ans;
}
public int adminpasschangeerror(string b)
{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["pass"]) == b)
{
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["login"].Rows.Count)
{
ans = 0;
}
return ans;
}
public int studentpasschangeerror(string b)
{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["pass"]) == b)
{
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["login"].Rows.Count)
{
ans = 0;
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 9
QUIZ MANAGEMENT SYSTEM

return ans;
}

public int deleteloginerrorchk(string b)


{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["name"]) == b)
{
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["login"].Rows.Count)
{
ans = 0;
}
return ans;
}
public int viewquestionerorchek(string b)
{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["qno"]) == b)
{
questions[0] = Convert.ToString(row["qstmt"]);
questions[1] = Convert.ToString(row["ans1"]);

questions[2] = Convert.ToString(row["ans2"]);

questions[3] = Convert.ToString(row["ans3"]);

questions[4] = Convert.ToString(row["ans4"]);

questions[5] = Convert.ToString(row["ans5"]);

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 10
QUIZ MANAGEMENT SYSTEM

questions[6] = Convert.ToString(row["crctans"]);

ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["addquest"].Rows.Count)
{
ans = 0;
}
return ans;
}
public int editquestionerrorchek(string b)
{
int i = 0;
int ans = 4;
foreach (DataRow row in dataset.Tables[0].Rows)
{
if (Convert.ToString(row["qno"]) == b)
{
ans = 1;
}
else
{
i++;
}
}
if (i == dataset.Tables["addquest"].Rows.Count)
{
ans = 0;
}
return ans;
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 11
QUIZ MANAGEMENT SYSTEM

MODULES AND CODING

QUIZ MANAGEMENT SYSTEM (FORM: 11)

This is a starting form of Quiz system project.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 12
QUIZ MANAGEMENT SYSTEM

CODING OF FORM 11:

//SPLASH SCREEN CODE//


private void Form11_Load(object sender, EventArgs e)
{

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 13
QUIZ MANAGEMENT SYSTEM

timer1.Start();
p.Value = 0;
timer2.Start();
}

private void timer1_Tick(object sender, EventArgs e)


{
this.Opacity += 0.02;
}

private void timer2_Tick(object sender, EventArgs e)


{
MDIParent1 paremtform = new MDIParent1();

if (p.Value >= p.Maximum - 1)


{
this.Opacity -= 0.3;
if (this.Opacity <= 0)
{
this.Hide();
timer2.Stop();
timer1.Stop();
paremtform.Show();
}
}
else
{
p.Value += 2;
}
}

WELCOME FORM (FORM: 13)

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 14
QUIZ MANAGEMENT SYSTEM

CODING OF FORM 13:

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 15
QUIZ MANAGEMENT SYSTEM

ADMINISTRATOR MAIN WINDOWS AFTER LOGIN SCREEN

//FOR MAKE QUIZ //

private void buildQuizToolStripMenuItem_Click(object sender, EventArgs e)


{
Form4 obj = new Form4();
obj.Show();
}

//FOR CONFIRM LOGOUT WINDOWS//

private void button1_Click(object sender, EventArgs e)


{
Form7 obj = new Form7();
obj.Show();
this.Close();
}

//FOR CONFIRM LOGOUT WINDOWS THROUGH MENUSTRIP//

private void logoutToolStripMenuItem_Click(object sender, EventArgs e)


{
Form7 obj = new Form7();
obj.Show();
this.Close();
}

//FOR VISUAL EFFECTS OF FORM//

private void timer1_Tick(object sender, EventArgs e)


{
this.Opacity += 0.1;
}

//STARTING VISUAL EFFECT THROUGH THIS TIMER//

private void Form2_Load(object sender, EventArgs e)


{
timer1.Start();
}

private void toolStripMenuItem3_Click(object sender, EventArgs e)


{

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 16
QUIZ MANAGEMENT SYSTEM

Form14 form14obj = new Form14();


form14obj.Show();
}

private void changeLoginPasswordToolStripMenuItem_Click(object sender, EventArgs e)


{
Form18 obj = new Form18();
obj.Show();
}

private void deleteLoginToolStripMenuItem_Click(object sender, EventArgs e)


{
Form19 obj = new Form19();
obj.Show();
}

private void printQuizToolStripMenuItem_Click(object sender, EventArgs e)


{
Form3 obj = new Form3();
obj.Show();
}

private void resultToolStripMenuItem_Click(object sender, EventArgs e)


{
Form20 obj = new Form20();
obj.Show();
}

private void solvedAnswerSheetReportToolStripMenuItem_Click(object sender, EventArgs e)


{
Form8 obj = new Form8();
obj.Show();
}

private void toolStripMenuItem1_Click(object sender, EventArgs e)


{
Form21 obj = new Form21();
obj.Show();
}

LOGIN SCREEN (MDI PARENT FORM):

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 17
QUIZ MANAGEMENT SYSTEM

This is a snapshot of MDI parent login form where Teachers and students make their login and enters for further

processing.

CODING OF MDI PARENT FORM 1:

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 18
QUIZ MANAGEMENT SYSTEM

//LOGIN SCREEN FORM CODE//

//FOR OPACITY OF LOGIN FORM TIMER IS RUNNING HERE//

private void MDIParent1_Load(object sender, EventArgs e)


{
timer1.Start();
}

//FOR EFFECTS OF OPACITY WORKING IS HERE//

private void timer1_Tick(object sender, EventArgs e)


{
this.Opacity += 0.1;
if (p.Value >= p.Maximum - 1)
{
timer1.Stop();
}

else
{
p.Value += 2;
}
}

//LOGIN BUTTON CODE//

private void button1_Click(object sender, EventArgs e)


{
string username = textBox1.Text;
string pass = textBox2.Text;
int x = 5;
string loginquery = "SELECT * FROM login where name = '" + username + "' and pass = '" + pass + "' and occu = '" +
comboBox1.SelectedItem + "' ";

quizsystem obj = new quizsystem();

obj.selection(loginquery,"login");
x=obj.loginerrorchek(username,pass,comboBox1.SelectedText);
if(x==1)
{
if (comboBox1.SelectedIndex == 0)
{
p.Value = 0;
timer1.Start();
Form1 form1obj = new Form1();

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 19
QUIZ MANAGEMENT SYSTEM

form1obj.Show();
this.Hide();
}
else if (comboBox1.SelectedIndex == 1)
{
p1.Value = 0;
timer2.Start();
Form4 form4obj = new Form4();
form4obj.Show();
this.Hide();
}
}
else if(x==0)
{
if (MessageBox.Show("Make Sure The Username and Password and Domain you entered is Correct?" + "\r\n" + "Do you
wish to try again ", "Incorrect Password", MessageBoxButtons.YesNo) == DialogResult.Yes)

{
this.Activate();
textBox1.Clear();
textBox2.Clear();
comboBox1.SelectedIndex=-1;
}
else
{
this.Close();
}
}
}

//PICTURE CHANGE IN PICTUREBOX SELECT ON COMOBOX OPTION CODE//

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
if (comboBox1.SelectedIndex == 0)
{
this.pictureBox2.Image = global::WindowsFormsApplication1.Properties.Resources.imagesuy;
}
else if (comboBox1.SelectedIndex == 1)
{
this.pictureBox2.Image = global::WindowsFormsApplication1.Properties.Resources.iconLogin1;
}
}

//FOR OPACITY EFFECT ANOTHER TIMER IS WORKING HERE//

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 20
QUIZ MANAGEMENT SYSTEM

private void timer2_Tick(object sender, EventArgs e)


{
this.Opacity += 0.1;
if (p1.Value >= p1.Maximum - 1)
{
timer2.Stop();
}
else
{
p1.Value += 2;
}
}

//APPEAR CREATE LOGIN FOR STUDENT HERE//

private void button3_Click(object sender, EventArgs e)


{
Form9 obj = new Form9();
obj.Show();
}

//OPEN PASSWORD RECOVERY FORM HERE//

private void button2_Click(object sender, EventArgs e)


{
Form5 obj = new Form5();
obj.Show();
}

//SHUT DOWN BUTTON CODE//

private void button4_Click(object sender, EventArgs e)


{
this.Close();
}

STARTING WINDOW FORM (FORM: 4)

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 21
QUIZ MANAGEMENT SYSTEM

Now this is a processing which leads to relevant process which is chosen, such as starting client windows.

CODING OF FORM 4:

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 22
QUIZ MANAGEMENT SYSTEM

//TO START THIS WINDOWS TIMER IS REQUIRED HERE FOR EFFECTS//

private void Form4_Load(object sender, EventArgs e)


{
p.Value = 0;
timer1.Start();
}

//TIMER WHERE EFFECT IS WORKING//

private void timer1_Tick(object sender, EventArgs e)


{
Form13 form13obj = new Form13();
if (p.Value >= p.Maximum - 1)
{
this.Opacity -= 0.4;
if (this.Opacity <= 0)
{
form13obj.Show();
this.Close();
}
}
else
{
p.Value += 2;
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 23
QUIZ MANAGEMENT SYSTEM

CREATE LOGIN FORM FOR STUDENTS (FORM: 9)

This screen is used for creating students login by fulfilling the relevant information like user name, password, security

question and its answer.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 24
QUIZ MANAGEMENT SYSTEM

CODING OF FORM 9:
// CREATE LOGIN FOR STUDENT FORM CODE//

//PASSWORD MATCH CODING ON TEXTBOX//

private void textBox4_TextChanged(object sender, EventArgs e)


{
if (textBox4.Text == textBox3.Text)
{
label5.Visible = true;
label6.Visible = false;
pictureBox1.Visible = true;
}

//BACK BUTTON CODING//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//CREATE LOGIN INSERT DATA CODE//

private void button1_Click(object sender, EventArgs e)


{
if (textBox2.Text == "" || textBox4.Text == "" || textBox3.Text == "" || textBox5.Text == "" || comboBox1.Items.Count==0)
{
MessageBox.Show("Must Enter all the info");
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
comboBox1.SelectedIndex = -1;
textBox5.Clear();
label5.Visible = false;
pictureBox1.Visible = false;
}
else
{
if (textBox4.Text != textBox3.Text)
{
label6.Visible = true;
label5.Visible = false;
pictureBox1.Visible = false;
}
else
{
try

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 25
QUIZ MANAGEMENT SYSTEM

{
string occu = textBox1.Text;
string name = textBox2.Text;
string pass = textBox4.Text;
string ans = textBox5.Text;
string insertstudentinfo = "insert into login values('" + name + "' , '" + pass + "' , '" + occu + "' , '" + ans + "' , '" +
comboBox1.SelectedItem + "')";
quizsystem loginobj = new quizsystem();
loginobj.insert(insertstudentinfo);
if (MessageBox.Show("Record has been stored successfully ", "Success", MessageBoxButtons.OK) == DialogResult.OK)
{
this.Close();
}

loginobj.conn.Close();
}
catch (Exception)
{
MessageBox.Show("This Account is Already Exist, Try Another Username");
}
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox2.Text == "")
{
MessageBox.Show("Must enter Username", "Access Denied");
}
else
{
pictureBox2.Visible = true;
label9.Visible = false;
label10.Visible = false;
string uname = textBox2.Text;
int x = 5;
string nameselect = "select * from login where name = '" + uname + "'";
quizsystem selectobj = new quizsystem();
selectobj.selection(nameselect, "login");
x = selectobj.passrecoveryerrorchek1(uname);
if (x == 1)
{

p.Value = 0;
timer1.Start();
}
else if (x == 0)
{

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 26
QUIZ MANAGEMENT SYSTEM

p1.Value = 0;
timer2.Start();
}
}
}

private void timer1_Tick(object sender, EventArgs e)


{
if (p.Value == p.Maximum)
{
label9.Visible = true;
label10.Visible = false;
pictureBox2.Visible = false;
timer1.Stop();
}
else
{
p.Value += 5;
}
}

private void timer2_Tick(object sender, EventArgs e)


{
if (p1.Value == p1.Maximum)
{
label9.Visible = false;
label10.Visible = true;
pictureBox2.Visible = false;
timer2.Stop();
}
else
{
p1.Value += 5;
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 27
QUIZ MANAGEMENT SYSTEM

ONLINE QUIZZ SHEET (FORM: 12)

This window is for taking quizzes from students, which is prepared by the Administrator.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 28
QUIZ MANAGEMENT SYSTEM

CODING OF FORM 12:

//ONLINE QUIZ SHEET FORM//

//BACK BUTTON CODE//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//ANSWER OPTIONS RADIOBUTONS CODE//

private void radioButton1_CheckedChanged(object sender, EventArgs e)


{
textBox9.Text = "A";
if (radioButton1.Checked)
{
radioButton2.Enabled = false;
radioButton3.Enabled = false;
radioButton4.Enabled = false;
radioButton5.Enabled = false;
}
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
textBox9.Text = "B";
if (radioButton2.Checked)
{
radioButton1.Enabled = false;
radioButton3.Enabled = false;
radioButton4.Enabled = false;
radioButton5.Enabled = false;
}
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)


{
textBox9.Text = "C";
if (radioButton3.Checked)
{
radioButton2.Enabled = false;
radioButton1.Enabled = false;
radioButton4.Enabled = false;

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 29
QUIZ MANAGEMENT SYSTEM

radioButton5.Enabled = false;
}
}

private void radioButton4_CheckedChanged(object sender, EventArgs e)


{
textBox9.Text = "D";
if (radioButton4.Checked)
{
radioButton2.Enabled = false;
radioButton3.Enabled = false;
radioButton1.Enabled = false;
radioButton5.Enabled = false;
}
}

private void radioButton5_CheckedChanged(object sender, EventArgs e)


{
textBox9.Text = "E";
if (radioButton5.Checked)
{
radioButton2.Enabled = false;
radioButton3.Enabled = false;
radioButton4.Enabled = false;
radioButton1.Enabled = false;
}
}

//QUIZ STARTING LOAD VALUES FROM TABLES CODE//

private void Form12_Load(object sender, EventArgs e)


{
string viewmsqt = "select * from marksheetdb";
quizsystem addquestobj2 = new quizsystem();
addquestobj2.selection(viewmsqt, "marksheetdb");
foreach (DataRow row in addquestobj2.dataset.Tables["marksheetdb"].Rows)
{

vqtm.Text = Convert.ToString(row["qt"]);
}
addquestobj2.conn.Close();
string viewasqt = "select * from answersheetdb";
quizsystem addquestobj3 = new quizsystem();
addquestobj3.selection(viewasqt, "answersheetdb");
foreach (DataRow row in addquestobj3.dataset.Tables["answersheetdb"].Rows)
{

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 30
QUIZ MANAGEMENT SYSTEM

vqtans.Text = Convert.ToString(row["qt"]);
}
addquestobj2.conn.Close();

string addquestview1 = "select * from addquest";


quizsystem addquestobj1 = new quizsystem();
addquestobj1.selection(addquestview1, "addquest");
foreach (DataRow row in addquestobj1.dataset.Tables["addquest"].Rows)
{

textBox8.Text = Convert.ToString(row["qno"]);
}
addquestobj1.conn.Close();

//INSTANTIATION OF POLIMORPHISAM VARIABLES ON FORM LOAD ON ACCOUNT OF COUNTER//

obj[0] = new obtainmarks();


obj[1] = new maxmarks();

/////////////////////////////////////////////////////////////////////

string titleview = "select * from createquiz";


quizsystem titleobj = new quizsystem();
titleobj.selection(titleview, "createquiz");
foreach (DataRow row in titleobj.dataset.Tables["createquiz"].Rows)
{
qt.Text = Convert.ToString(row["qt"]);
cn.Text = Convert.ToString(row["cn"]);
ct.Text = Convert.ToString(row["ct"]);
ti.Text = Convert.ToString(row["ci"]);
tm.Text = Convert.ToString(row["mm"]);
ta.Text = Convert.ToString(row["ta"]);
d.Text = Convert.ToString(row["qd"]);
ei.Text = Convert.ToString(row["et"]);
}
if (textBox8.Text == "")
{
if (MessageBox.Show("There is no quiz for Attemt" + "\r\n" + "Please contact to your Instructor", "Access Denied",
MessageBoxButtons.OK) == DialogResult.OK)
{
this.Close();
}
}
else if (textBox8.Text != "")
{

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 31
QUIZ MANAGEMENT SYSTEM

string addquestview = "select * from addquest";


quizsystem addquestobj = new quizsystem();
addquestobj.selection(addquestview, "addquest");
foreach (DataRow row in addquestobj.dataset.Tables["addquest"].Rows)
{
listBox1.Items.Add(Convert.ToString(row["qno"]));

}
addquestobj.conn.Close();
listBox1.SelectedIndex = 0;
}

//QUESTION APPEAR ON LISTBOX INDEX CHANGE CODE//

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)


{

string selectquest = "select * from addquest where qno='" + listBox1.SelectedItem + "'";


quizsystem select = new quizsystem();
select.selection(selectquest, "addquest");
foreach (DataRow row in select.dataset.Tables["addquest"].Rows)
{
qno.Text = Convert.ToString(row["qno"]);
qs.Text = Convert.ToString(row["qstmt"]);
opt1.Text = Convert.ToString(row["ans1"]);
opt2.Text = Convert.ToString(row["ans2"]);
opt3.Text = Convert.ToString(row["ans3"]);
opt4.Text = Convert.ToString(row["ans4"]);
opt5.Text = Convert.ToString(row["ans5"]);
cans.Text = Convert.ToString(row["crctans"]);
}
select.conn.Close();
if (listBox1.SelectedIndex == listBox1.Items.Count - 1)
{
button1.Visible = false;
button2.Visible = true;
}
}

//ARRAY OBJECT CALL FOR POLIMORPHISAM//

obtainmarks[] obj = new obtainmarks[2];

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 32
QUIZ MANAGEMENT SYSTEM

//TO SOLVE THE QUIZ -----NEXT BUTTON CODE---FOR LAST QUESTION//

private void button2_Click_1(object sender, EventArgs e)


{
try
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("Must enter the Roll No and Name");
}
else
{
if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked || radioButton4.Checked ||
radioButton5.Checked)
{
obj[1].count();
mm.Text = Convert.ToString(obj[1].m);
if (textBox9.Text == cans.Text)
{
obj[0].count();
gm.Text = Convert.ToString(obj[0].om);
textBox3.Text = "Correct Answer";
}
else if (textBox9.Text != cans.Text)
{
textBox3.Text = "Wrong Answer";
textBox4.Text = cans.Text;
}
decimal result = (obj[0].om / obj[1].m) * 100;
r.Text = Convert.ToString(result);
string rolno = textBox1.Text;
string nam = textBox2.Text;
string ans = textBox9.Text;
string rs = textBox3.Text; ;
string crctans = textBox4.Text;
if (crctans != "")
{ crctans = "Correct Answer: " + textBox4.Text; }
else
{ crctans = ""; }
string ansstmt = textBox5.Text;
string rsltstmt = textBox7.Text;

string insert1 = "insert into answersheet values('" + rolno + "','" + nam + "','" + qno.Text + "','" + qs.Text + "','" + opt1.Text +
"','" + opt2.Text + "','" + opt3.Text + "','" + opt4.Text + "','" + opt5.Text + "','" + ansstmt + "','" + ans + "','" + rsltstmt + "','" + rs + "','" +
crctans + "')";
quizsystem insertanswersheet = new quizsystem();

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 33
QUIZ MANAGEMENT SYSTEM

insertanswersheet.insert(insert1);
string insert2 = "insert into answersheetdb values('" + vqtans.Text +"','" + rolno + "','" + nam + "','" + qno.Text + "','" +
qs.Text + "','" + opt1.Text + "','" + opt2.Text + "','" + opt3.Text + "','" + opt4.Text + "','" + opt5.Text + "','" + ansstmt + "','" + ans + "','" +
rsltstmt + "','" + rs + "','" + crctans + "')";

insertanswersheet.insert(insert2);
insertanswersheet.conn.Close();
if (listBox1.SelectedIndex == listBox1.Items.Count - 1)
{
if (MessageBox.Show("Thank You" + "\r\n" + "Press Ok To Proceed", "Completion", MessageBoxButtons.OK) ==
DialogResult.OK)
{

string rolino = textBox1.Text;


string namm = textBox2.Text;
string crct = gm.Text;
string atmpt = mm.Text;
string rslt = r.Text;
string insertms = "insert into marksheet values('" + rolino + "','" + namm + "','" + atmpt + "','" + crct + "','" + rslt + "')";
quizsystem insertmarksheet = new quizsystem();
insertmarksheet.insert(insertms);
string insertms1 = "insert into marksheetdb values('"+ vqtm.Text +"','" + rolino + "','" + namm + "','" + atmpt + "','" +
crct + "','" + rslt + "')";
insertmarksheet.insert(insertms1);
this.Close();
}
}
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
textBox9.Clear();
}
else
{
MessageBox.Show("Must Select The Option for Answer", "Denied");
}
}
}
catch (Exception ex)
{
if (MessageBox.Show("Quiz has been solved by you before" + "\r\n" + "so please i advised you to leave now", "Access Denied",
MessageBoxButtons.OK) == DialogResult.OK)
{
this.Close();

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 34
QUIZ MANAGEMENT SYSTEM

}
}
textBox4.Clear();
}

//TO SOLVE THE QUIZ -----NEXT BUTTON CODE---FOR NEXT QUESTION//

private void button1_Click(object sender, EventArgs e)


{
try
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("Must enter the Roll No and Name");

}
else
{
if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked || radioButton4.Checked ||
radioButton5.Checked)
{
obj[1].count();
mm.Text = Convert.ToString(obj[1].m);
if (textBox9.Text == cans.Text)
{
obj[0].count();
gm.Text = Convert.ToString(obj[0].om);
textBox3.Text = "Correct Answer";
}
else if (textBox9.Text != cans.Text)
{
textBox3.Text = "Wrong Answer";
textBox4.Text = cans.Text;
}

decimal result = (obj[0].om / obj[1].m) * 100;


r.Text = Convert.ToString(result);
string rolno = textBox1.Text;
string nam = textBox2.Text;
string ans = textBox9.Text;
string rs = textBox3.Text; ;
string crctans = textBox4.Text;
if (crctans != "")
{ crctans = "Correct Answer: " + textBox4.Text; }
else
{ crctans = ""; }

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 35
QUIZ MANAGEMENT SYSTEM

string ansstmt = textBox5.Text;


string rsltstmt = textBox7.Text;

string insert1 = "insert into answersheet values('" + rolno + "','" + nam + "','" + qno.Text + "','" + qs.Text + "','" + opt1.Text +
"','" + opt2.Text + "','" + opt3.Text + "','" + opt4.Text + "','" + opt5.Text + "','" + ansstmt + "','" + ans + "','" + rsltstmt + "','" + rs + "','" +
crctans + "')";
quizsystem insertanswersheet = new quizsystem();
insertanswersheet.insert(insert1);
string insert2 = "insert into answersheetdb values('" + vqtans.Text + "','" + rolno + "','" + nam + "','" + qno.Text + "','" +
qs.Text + "','" + opt1.Text + "','" + opt2.Text + "','" + opt3.Text + "','" + opt4.Text + "','" + opt5.Text + "','" + ansstmt + "','" + ans + "','" +
rsltstmt + "','" + rs + "','" + crctans + "')";

insertanswersheet.insert(insert2);
insertanswersheet.conn.Close();
radioButton1.Enabled = true;
radioButton2.Enabled = true;
radioButton3.Enabled = true;
radioButton4.Enabled = true;
radioButton5.Enabled = true;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
textBox9.Clear();
listBox1.SelectedIndex = listBox1.SelectedIndex += 1;
}
else
{
MessageBox.Show("Must Select The Option for Answer", "Denied");
}
}
}
catch (Exception ex)
{
if (MessageBox.Show("Quiz has been solved by you before" + "\r\n" + "so please I advised you to leave now", "Access Denied",
MessageBoxButtons.OK) == DialogResult.OK)
{
this.Close();
}
}
textBox4.Clear();
}

}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 36
QUIZ MANAGEMENT SYSTEM

PASSWORD RECOVERY FORM (FORM 5)

These two forms are made for password recovery. Students enter his / her user name, if the user name is correct the

next form appears otherwise the error will shown. In next form student have to answer a security question. If the

answer is right the correct password will be shown otherwise the error message will shown.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 37
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//PASSWORD RECOVERY FORM CODE//

//FOR USERNAME VERIFICATION FOR NEXT SEQURITY QUESTION GROUPBOX//

private void button1_Click(object sender, EventArgs e)


{
string uname = textBox1.Text;
int x = 5;
string nameselect = "select * from login where name = '" + uname + "'";
quizsystem selectobj = new quizsystem();
selectobj.selection(nameselect, "login");
x=selectobj.passrecoveryerrorchek1(uname);
if (x == 1)
{
pictureBox1.Visible = true;
p.Value = 0;
timer1.Start();
}
else if (x == 0)
{
if (MessageBox.Show("Make Sure The Username you entered is Correct?" + "\r\n" + "Do you wish to try again ", "Incorrect
Username", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Activate();
textBox1.Clear();
textBox1.Focus();
}
else
{
this.Close();
}
}
}

//BACK BUTTON//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 38
QUIZ MANAGEMENT SYSTEM

//PROGRESSBAR WORKING ON USERNAME THEN SHOW SEQURITY AREA//

private void timer1_Tick(object sender, EventArgs e)


{
if (p.Value == p.Maximum)
{
pictureBox1.Hide();
groupBox1.Visible = true;
}
else
{
p.Value += 5;
}
}

//AFTER USERNAME VERIFIED SQURITY QUESTION VERIFY PROGRESSBARR RUN ON THIS WORKING//

private void timer2_Tick(object sender, EventArgs e)


{
if (p1.Value == p1.Maximum)
{
pictureBox2.Hide();
label4.Visible = true;
label5.Visible = true;
}
else
{
p1.Value += 5;
}
}

//AFTER USERNAME ENTER SECURITY AREA WILL SHOW AND WHEN IT MATCH THEN SHOW PASSWORD//

private void button2_Click(object sender, EventArgs e)


{
string ans = textBox2.Text;
string name = textBox1.Text;
int x = 5;
string sqselect = "select * from login where name= '" + name + "' and sq = '" + comboBox1.SelectedItem + "' and ans = '" + ans + "'
";
quizsystem selectobj = new quizsystem();
selectobj.selection(sqselect, "login");
x = selectobj.passrecoveryerrorchek2(comboBox1.SelectedText, ans);
if (x == 1)

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 39
QUIZ MANAGEMENT SYSTEM

{
label5.Text = selectobj.pass;
p1.Value = 0;
timer2.Start();
pictureBox2.Visible = true;
}
else if (x == 0)
{
if (MessageBox.Show("Make Sure The Username you entered is Correct?" + "\r\n" + "Do you wish to try again ",
"Incorrect Username", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Activate();
comboBox1.SelectedItem = -1;
textBox2.Clear();
}

}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 40
QUIZ MANAGEMENT SYSTEM

LOGOUT FORM (FORM 16)

Students can also logout from the system after giving quiz by clicking on logout from the main menu and then the

following form appears to confirm logout.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 41
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//CONFIRM LOGOUT FOR ADMIN MAIN WINDOWS//

//SHUTDOWN BUTON-----APPEAR SHUTTING DOWN WINDOWS FORM ON THIS WORKING//

private void button1_Click(object sender, EventArgs e)


{
Form6 obj = new Form6();
obj.Show();
this.Close();
}

//CANCEL BUTTON-----------APPEAR BACK STUDENT MAIN WINDOWS//

private void button2_Click(object sender, EventArgs e)


{
Form2 obj = new Form2();
obj.Show();
this.Hide();
}

//CANCEL BUTTON CODE------FOR APPEAR STUDENT MAIN WINDOWS FORM BACK //

private void button2_Click(object sender, EventArgs e)


{
Form13 obj = new Form13();
obj.Show();
this.Hide();
}

//LOGOUT CODE---------SHUTTING DOWN WINDOWS LOADING SCREEN APPEAR ON IT//

private void button1_Click(object sender, EventArgs e)


{
Form6 obj = new Form6();
obj.Show();
this.Close();

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 42
QUIZ MANAGEMENT SYSTEM

SHUT DOWN LOADING SCREEN FORM (FORM 6)

After clicking on confirm logout sign the next window appears for shutdown. Which means now the user is no more sign

in.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 43
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//OPACITY FUNCTION USE ON THIS-------AFTER OPACITY=0 MAIN LOGIN FORM WILL APPEAR AGAIN//

private void timer1_Tick(object sender, EventArgs e)


{
if (p.Value >= p.Maximum - 1)
{
MDIParent1 obj = new MDIParent1();
this.Opacity -= 0.4;
if (this.Opacity <= 0)
{
this.Close();
obj.Show();
}
}
else
{
p.Value += 2;
}
}

//TIMER START HERE FOR EFFECTS//

private void Form6_Load(object sender, EventArgs e)


{
p.Value = 0;
timer1.Start();
}
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 44
QUIZ MANAGEMENT SYSTEM

STARTING ADMIN WINDOWS LOADING FORM (FORM 1)

Now another phase of program designed for Teachers, from the same login window teachers can also login by selecting administrator

mode from the occupation option. Once giving admin login, the screen appears for admin members to go through into quiz process.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 45
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

// FORM 1-----LOGON STRING WINDOWS LOADING SCREEN CODE//

private void Form1_Load(object sender, EventArgs e)


{
p.Value = 0;
timer1.Start();
}

private void timer1_Tick(object sender, EventArgs e)


{
Form2 obj = new Form2();
if (p.Value >= p.Maximum - 1)
{
this.Opacity -= 0.4;
if (this.Opacity <= 0)
{
this.Close();
obj.Show();
}
}
else
{
p.Value += 2;
}
}
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 46
QUIZ MANAGEMENT SYSTEM

CHANGE ADMIN INFO FORM (FORM 18)

This screen is used for creating Administration login by fulfilling the relevant information like user name, password,

security question and its answer. There is also an option for recovering old password for Administration and changing

the pass key.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 47
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//ADMIN USERNAME AND PASSWORD CHANGE FORM CODE//

//FOR PASSWORD MATCH ON TEXTBOX CODEE//

private void textBox4_TextChanged(object sender, EventArgs e)


{
if (textBox4.Text == textBox3.Text)
{
label5.Visible = true;
label6.Visible = false;
pictureBox1.Visible = true;
}
}

//BACK BUTTON//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//CREATE BUTTON CODE//

private void button1_Click(object sender, EventArgs e)


{
if (textBox2.Text == "" || textBox4.Text == "" || textBox3.Text == "" || textBox5.Text == ""||comboBox1.Items.Count==0)
{
MessageBox.Show("Must Enter all the info");
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
comboBox1.SelectedIndex = -1;
textBox5.Clear();
label5.Visible = false;
pictureBox1.Visible = false;
}
else

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 48
QUIZ MANAGEMENT SYSTEM

{
if (textBox4.Text != textBox3.Text)
{
label6.Visible = true;
label5.Visible = false;
pictureBox1.Visible = false;
}
else
{
string username = textBox2.Text;
string occu = textBox1.Text;
string newpass = textBox4.Text;
string ans = textBox5.Text;
string oldpass = textBox6.Text;
int x = 5;
string select = "select * from login";
quizsystem obj = new quizsystem();
obj.selection(select, "login");
x = obj.adminpasschangeerror(oldpass);
if (x == 1)
{
string update = "update login set name='" + username + "', pass='" + newpass + "', ans='" + ans + "',sq='" +
comboBox1.SelectedItem + "',occu='" + occu + "' where pass='" + oldpass + "'";
obj.update(update);
MessageBox.Show("Your Username and Password Has Been Changed Successfully");
obj.conn.Close();
}
else if (x == 0)
{
MessageBox.Show("Old Password is Incorrect", "denied");
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 49
QUIZ MANAGEMENT SYSTEM

CREATE QUIZ FORM (GROUPBOX 3)

Below form is facilitating teachers for modifying quizzes, creating quiz and adding questions in quiz. This module has

also a function of edit, view and update quiz.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 50
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//QUIZ TITLE MODIFIED FORM//

//ON FORM LOAD VIEW OF PREVIOUS QUIZ TITLE INFO FOR EDIT//

private void Form15_Load(object sender, EventArgs e)


{
string titleview = "select * from createquiz";
quizsystem createobj = new quizsystem();
createobj.selection(titleview, "createquiz");
foreach (DataRow row in createobj.dataset.Tables["createquiz"].Rows)
{
textBox1.Text = Convert.ToString(row["qt"]);
t1.Text = Convert.ToString(row["qt"]);
t2.Text = Convert.ToString(row["cn"]);
t3.Text = Convert.ToString(row["ct"]);
t4.Text = Convert.ToString(row["ci"]);
t5.Text = Convert.ToString(row["mm"]);
t6.Text = Convert.ToString(row["ta"]);
t7.Text = Convert.ToString(row["qd"]);
t8.Text = Convert.ToString(row["et"]);
}
createobj.conn.Close();
}

//EDIT BOTTUN CODE----FOR EDIT QUIZ TITLE//

private void button7_Click(object sender, EventArgs e)


{
string tb1 = t1.Text;
string tb2 = t2.Text;
string tb3 = t3.Text;
string tb4 = t4.Text;
string tb5 = t5.Text;
string tb6 = t6.Text;
string tb7 = t7.Text;
string tb8 = t8.Text;
string getbox = textBox1.Text;
string edit = "update createquiz set qt='" + tb1 + "' , cn='" + tb2 + "',ct='" + tb3 + "',ci='" + tb4 + "' , mm='" + tb5 + "',ta='" + tb6 +
"',qd='" + tb7 + "',et='" + tb8 + "' where qt='" + getbox + "'";

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 51
QUIZ MANAGEMENT SYSTEM

quizsystem createobj = new quizsystem();


createobj.update(edit);
MessageBox.Show("Quiz Title has been Added Successfully", "Success");
createobj.conn.Close();
}

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//DATE TIME PIKER CODE ON DATE TIME PIKER//

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)


{
t7.Text = Convert.ToString(dateTimePicker1.Value);
}

private void label15_Click(object sender, EventArgs e)


{

}
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 52
QUIZ MANAGEMENT SYSTEM

ADD QUESTION FORM (GROUPBOX 1)

This is a form for adding questions one by one in quiz by respective teacher.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 53
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//CREATE QUIZ FORM//

//BACK BUTTON CODE//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//FOR CORRECT OPTION FOR ANSWER RADIOBUTTONS CODE ON CREATE QUIZ GROUPBOX//

private void radioButton1_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "A";
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "B";
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "C";
}

private void radioButton4_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "D";
}

private void radioButton5_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "E";
}

//DATE TIME PIKER CODE//

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)


{
t7.Text = Convert.ToString(dateTimePicker1.Value);
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 54
QUIZ MANAGEMENT SYSTEM

//FOR CREATE QUIZ TITLE -------NEXT BUTTON CODE//

private void button7_Click(object sender, EventArgs e)


{

if (t1.Text != " " && t2.Text != "" && t3.Text != "" && t4.Text != "" && t5.Text != ""&& t6.Text != "" && t7.Text != "")
{
string tb1 = t1.Text;
string tb2 = t2.Text;
string tb3 = t3.Text;
string tb4 = t4.Text;
string tb5 = t5.Text;
string tb6 = t6.Text;
string tb7 = t7.Text;
string tb8 = t8.Text;
string getbox = textBox1.Text;
string insertqt = "insert into marksheetdb values('" + tb1 + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "')";
string insertqt1 = "insert into answersheetdb values('" + tb1 + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " +
"','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "','" + " " + "')";
quizsystem insertqtobj = new quizsystem();
insertqtobj.insert(insertqt);
insertqtobj.insert(insertqt1);
string edit = "update createquiz set qt='" + tb1 + "' , cn='" + tb2 + "',ct='" + tb3 + "',ci='" + tb4 + "' , mm='" + tb5 + "',ta='" + tb6 +
"',qd='" + tb7 + "',et='" + tb8 + "' where qt='" + getbox + "'";
quizsystem createobj = new quizsystem();
createobj.update(edit);
MessageBox.Show("Quiz Title has been Added Successfully", "Success");
createobj.conn.Close();
if (textBox2.Text == "")
{
groupBox3.Visible = false;
groupBox1.Visible = true;
}
else if (textBox2.Text != "")
{
string addquestview = "select * from addquest";
quizsystem addquestobj = new quizsystem();
addquestobj.selection(addquestview, "addquest");
foreach (DataRow row in addquestobj.dataset.Tables["addquest"].Rows)
{
listBox1.Items.Add(Convert.ToString(row["qno"]));
}
addquestobj.conn.Close();
listBox1.SelectedIndex = 0;
groupBox2.Visible = true;
groupBox3.Visible = false;

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 55
QUIZ MANAGEMENT SYSTEM

}
}
else
{
MessageBox.Show("Make sure that all the required lines are fullfilled", "Access Denied");

t1.Focus();

}
}

//FOR ADD QUESTIONS----------NEXT BUTTON CODE//

private void button1_Click(object sender, EventArgs e)


{
try
{
if (tb1.Text != "" && tb2.Text != "" && tb3.Text != "" && tb5.Text != "" && tb7.Text != "" && tb9.Text != "" && tb11.Text !=
"")
{
if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked || radioButton4.Checked || radioButton5.Checked)
{

string tbox1 = tb1.Text;


string tbox2 = tb2.Text;
string tbox3 = tb3.Text;
string tbox5 = tb5.Text;
string tbox7 = tb7.Text;
string tbox9 = tb9.Text;
string tbox11 = tb11.Text;
string tbox13 = tb13.Text;
string question = "insert into addquest values('" + tbox1 + "' , '" + tbox2 + "','" + tbox3 + "','" + tbox5 + "','" + tbox7 + "','" +
tbox9 + "','" + tbox11 + "','" + tbox13 + "')";
quizsystem addquest = new quizsystem();
addquest.insert(question);
MessageBox.Show("Question has been Added Successfully", "Success");
addquest.conn.Close();
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
tb1.Focus();
tb2.Clear();
tb3.Clear();
tb5.Clear();

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 56
QUIZ MANAGEMENT SYSTEM

tb7.Clear();
tb9.Clear();
tb11.Clear();
tb13.Clear();
}
else
{
MessageBox.Show("Must Select the Correct Answer Option", "Denied");
}
}
else
{
MessageBox.Show("Make Sure that all the required lines are fullfilled", "Access Denied");

tb1.Focus();
}

}
catch (Exception)
{
MessageBox.Show("The Question you entered is Already Exist", "Denied");
tb1.Clear();
tb1.Focus();

}
}

//CREATE QUIZ------- VIEW BUTTON CODE----ADD QUESTON GROUPBOX//

private void button5_Click(object sender, EventArgs e)


{
string tbox1 = tb1.Text;
string tbox2 = tb2.Text;
string tbox3 = tb3.Text;

string tbox5 = tb5.Text;

string tbox7 = tb7.Text;

string tbox9 = tb9.Text;

string tbox11 = tb11.Text;

string tbox13 = tb13.Text;


int x = 5;

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 57
QUIZ MANAGEMENT SYSTEM

string viewquest = "select * from addquest where qno='" + tbox1 + "'";


quizsystem obj = new quizsystem();
obj.selection(viewquest, "addquest");
x= obj.viewquestionerorchek(tbox1);
if (x == 1)
{
tb2.Text = obj.questions[0];
tb3.Text = obj.questions[1];
tb5.Text = obj.questions[2];
tb7.Text = obj.questions[3];
tb9.Text = obj.questions[4];
tb11.Text = obj.questions[5];
tb13.Text = obj.questions[6];
}
if (x == 0)
{
MessageBox.Show("The Question Number you entered dosent Exist", "Denied");
tb1.Focus();
}
}

//VIEW CODE AGAIN AND EDIT QUESTION ENTERY ON ADD QUESTION GROUPBOX AND IF THERE IS NO ENTRY IN THE
BACK END IT IS ALSO A EXCEPTION HANDLEING CODEE FOR NULL VIEW CODE//

private void button4_Click(object sender, EventArgs e)


{
string questno= tb1.Text;
int x = 5;
string edit = "select * from addquest where qno='" + questno + "'";
quizsystem createobj = new quizsystem();
createobj.selection(edit, "addquest");
x = createobj.editquestionerrorchek(questno);
if (x == 1)
{
string tbox1 = tb1.Text;
string tbox2 = tb2.Text;
string tbox3 = tb3.Text;
string tbox5 = tb5.Text;
string tbox7 = tb7.Text;
string tbox9 = tb9.Text;
string tbox11 = tb11.Text;
string tbox13 = tb13.Text;
string editaddquest = "update addquest set qstmt='" + tbox2 + "' , ans1='" + tbox3 + "',ans2='" + tbox5 + "' ,ans3='" + tbox7 +
"',ans4='" + tbox9 + "',ans5='" + tbox11 + "',crctans='" + tbox13 + "' where qno='" + tbox1 + "'";
createobj.update(editaddquest);
MessageBox.Show("Question is Modified Successfully", "Success");

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 58
QUIZ MANAGEMENT SYSTEM

createobj.conn.Close();
}
else if (x == 0)
{
MessageBox.Show("The question which u trying to edid is not in the entry", "denied");
}

//FOR DELETE GROUPBOX IF THERE IS NO QUESTIONS IN THE BACK END FOR LAST QUESTION DELETE IF THERE IS ONLY
1 QUESTION IN BACK END CODE//

private void Form14_Load(object sender, EventArgs e)


{
string deletemarksheets = "delete * from marksheet";
quizsystem markshetobj = new quizsystem();
markshetobj.delete(deletemarksheets);
string deleteanssheet = "delete * from answersheet";
quizsystem anssheetobj = new quizsystem();
anssheetobj.delete(deleteanssheet);

string view = "select * from addquest";


quizsystem obj = new quizsystem();
obj.selection(view, "addquest");
foreach(DataRow row in obj.dataset.Tables["addquest"].Rows)
{
textBox2.Text = Convert.ToString(row["qno"]);
}
obj.conn.Close();
string titleview = "select * from createquiz";
quizsystem createobj = new quizsystem();
createobj.selection(titleview, "createquiz");
foreach (DataRow row in createobj.dataset.Tables["createquiz"].Rows)
{
textBox1.Text = Convert.ToString(row["qt"]);
}
createobj.conn.Close();
}

//FOR DELETE ALL THE QUESTION ON NEXT BUTTON CODE//

private void button10_Click(object sender, EventArgs e)


{
string deletequestions="delete from addquest where qno='"+listBox1.SelectedItem+"'";
quizsystem obj = new quizsystem();
obj.delete(deletequestions);

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 59
QUIZ MANAGEMENT SYSTEM

listBox1.SelectedIndex = listBox1.SelectedIndex += 1;
if (listBox1.SelectedIndex == listBox1.Items.Count-1)
{
button10.Visible = false;
button8.Visible = true;
}
}

//DELETE GROUPBOX------FOR LAST QUESTION DELETE ON ANOTHER NEXT BUTTON CODE//

private void button8_Click(object sender, EventArgs e)


{
string deletequestions = "delete from addquest where qno ='" + listBox1.SelectedItem + "'";
quizsystem obj = new quizsystem();
obj.delete(deletequestions);
if (MessageBox.Show("All the Questions has been deleted from database" + "\r\n" + "press ok to proceed for add new entries of
questions", "Delete Complete", MessageBoxButtons.OK) == DialogResult.OK)
{
groupBox2.Visible = false;
groupBox1.Visible = true;
}
}

//CREATE QUESTIONS GROUPBOX-----FOR APPEAR CREATE QUIZ TITLE FORM -----EDIT BUTTON CODE//

private void button6_Click(object sender, EventArgs e)


{
Form15 obj = new Form15();
obj.Show();
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)


{
if (listBox1.SelectedIndex == listBox1.Items.Count - 1)
{

button10.Visible = false;
button8.Visible = true;
}
}

private void button11_Click(object sender, EventArgs e)


{
groupBox2.Visible = false;
groupBox1.Visible = true;
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 60
QUIZ MANAGEMENT SYSTEM

private void button12_Click(object sender, EventArgs e)


{
groupBox3.Visible = false;
groupBox2.Visible = true;
}
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 61
QUIZ MANAGEMENT SYSTEM

DELETE QUESTION (GROUPBOX 2)

Following in the delete form appeared before teachers create quiz window if there is already any quiz exists in the

module or database record.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 62
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//FOR DELETE GROUPBOX IF THERE IS NO QUESTIONS IN THE BACK END FOR LAST QUESTION DELETE IF THERE IS ONLY 1
QUESTION IN BACK END CODE//

private void Form14_Load(object sender, EventArgs e)


{
string view = "select * from addquest";
quizsystem obj = new quizsystem();
obj.selection(view, "addquest");
foreach(DataRow row in obj.dataset.Tables["addquest"].Rows)
{
textBox2.Text = Convert.ToString(row["qno"]);
}
obj.conn.Close();
string titleview = "select * from createquiz";
quizsystem createobj = new quizsystem();
createobj.selection(titleview, "createquiz");
foreach (DataRow row in createobj.dataset.Tables["createquiz"].Rows)
{
textBox1.Text = Convert.ToString(row["qt"]);
}
createobj.conn.Close();
}
//FOR DELETE ALL THE QUESTION ON NEXT BUTTON CODE//

private void button10_Click(object sender, EventArgs e)


{
string deletequestions="delete from addquest where qno='"+listBox1.SelectedItem+"'";
quizsystem obj = new quizsystem();
obj.delete(deletequestions);
listBox1.SelectedIndex = listBox1.SelectedIndex += 1;
if (listBox1.SelectedIndex == listBox1.Items.Count-1)
{
button10.Visible = false;
button8.Visible = true;
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 63
QUIZ MANAGEMENT SYSTEM

//DELETE GROUPBOX------FOR LAST QUESTION DELETE ON ANOTHER NEXT BUTTON CODE//

private void button8_Click(object sender, EventArgs e)


{
string deletequestions = "delete from addquest where qno ='" + listBox1.SelectedItem + "'";
quizsystem obj = new quizsystem();
obj.delete(deletequestions);
if (MessageBox.Show("All the Questions has been deleted from database" + "\r\n" + "press ok to proceed for add new entries of
questions", "Delete Complete", MessageBoxButtons.OK) == DialogResult.OK)
{
groupBox2.Visible = false;
groupBox1.Visible = true;
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 64
QUIZ MANAGEMENT SYSTEM

GOOGLE SEARCH (FORM: 21)

An option of Google search is added to help the teachers. By clicking on search in main menu helps tab the internet

explorer window appears.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 65
QUIZ MANAGEMENT SYSTEM

DELETE STUDENT LOGIN FORM:

//DELETE DATA THROUGH USERNAME//

private void button1_Click(object sender, EventArgs e)


{
string uname = textBox2.Text;
int x = 5;

string select ="select * from login";


quizsystem deleteloginobj = new quizsystem();
deleteloginobj.selection(select, "login");
x = deleteloginobj.deleteloginerrorchk(uname);
if (x == 1)
{
string delete = "delete from login where name ='" + uname + "'";
deleteloginobj.delete(delete);
MessageBox.Show("Record Has Been Successfully Deleted", "Success");
deleteloginobj.conn.Close();
}
else if (x == 0)
{
if (MessageBox.Show("Make Sure Username you entered is Correct?" + "\r\n" + "Do you wish to try again ", "Incorrect Code",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Activate();
textBox2.Clear();
textBox2.Focus();
}
else
{
this.Close();
}
}
}

//BACK BUTTON CODE//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 66
QUIZ MANAGEMENT SYSTEM

EDIT QUESTIONS FORM (FORM: 10)

This is a form for editing questions for prints during the printing reports to make the interface more users friendly.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 67
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//EDIT QUESTION SESSION FORM//

//EDIT WUIZ TITLE FUNTION-----EDIT BUTTON//

private void button6_Click(object sender, EventArgs e)


{
Form15 obj = new Form15();
obj.Show();
}

//VIEW BUTTON--------FOR PREVIOUS QUESTION VIEW//

private void button5_Click(object sender, EventArgs e)


{
string tbox1 = tb1.Text;
string tbox2 = tb2.Text;
string tbox3 = tb3.Text;

string tbox5 = tb5.Text;

string tbox7 = tb7.Text;

string tbox9 = tb9.Text;

string tbox11 = tb11.Text;

string tbox13 = tb13.Text;


int x = 5;
string viewquest = "select * from addquest where qno='" + tbox1 + "'";
quizsystem obj = new quizsystem();
obj.selection(viewquest, "addquest");
x = obj.viewquestionerorchek(tbox1);
if (x == 1)
{
tb2.Text = obj.questions[0];
tb3.Text = obj.questions[1];
tb5.Text = obj.questions[2];
tb7.Text = obj.questions[3];
tb9.Text = obj.questions[4];
tb11.Text = obj.questions[5];
tb13.Text = obj.questions[6];
}
if (x == 0)

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 68
QUIZ MANAGEMENT SYSTEM

{
MessageBox.Show("The Question Number you entered dosent Exist", "Denied");
tb1.Focus();
}
}

//EDIT QUESITON FUNCTION--------EDIT BUTTON//

private void button4_Click(object sender, EventArgs e)


{

string questno = tb1.Text;


int x = 5;
string edit = "select * from addquest where qno='" + questno + "'";
quizsystem createobj = new quizsystem();
createobj.selection(edit, "addquest");
x = createobj.editquestionerrorchek(questno);
if (x == 1)
{
if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked || radioButton4.Checked || radioButton5.Checked)
{
string tbox1 = tb1.Text;
string tbox2 = tb2.Text;
string tbox3 = tb3.Text;
string tbox5 = tb5.Text;
string tbox7 = tb7.Text;
string tbox9 = tb9.Text;
string tbox11 = tb11.Text;
string tbox13 = tb13.Text;
string editaddquest = "update addquest set qstmt='" + tbox2 + "' , ans1='" + tbox3 + "',ans2='" + tbox5 + "' ,ans3='" + tbox7 +
"',ans4='" + tbox9 + "',ans5='" + tbox11 + "',crctans='" + tbox13 + "' where qno='" + tbox1 + "'";
createobj.update(editaddquest);
MessageBox.Show("Question is Modified Successfully", "Success");
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
createobj.conn.Close();
}
else
{
MessageBox.Show("Must Select the Correct Answer Option", "Denied");
}
}
else if (x == 0)

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 69
QUIZ MANAGEMENT SYSTEM

{
MessageBox.Show("The question which u trying to edid is not in the entry", "denied");
}
}

//RADIOBUTTON CLICK EVENT----------FOR CORRECT ANSWER//

private void radioButton1_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "A";
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "B";
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "C";
}

private void radioButton4_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "D";
}

private void radioButton5_CheckedChanged(object sender, EventArgs e)


{
tb13.Text = "E";
}

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//NEXT BUTTON---------TO ADD NEW QUESTION//

private void button1_Click(object sender, EventArgs e)


{
try
{
if (tb1.Text != "" && tb2.Text != "" && tb3.Text != "" && tb5.Text != "" && tb7.Text != "" && tb9.Text != "" && tb11.Text != "")
{

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 70
QUIZ MANAGEMENT SYSTEM

if (radioButton1.Checked || radioButton2.Checked || radioButton3.Checked || radioButton4.Checked ||


radioButton5.Checked)
{

string tbox1 = tb1.Text;


string tbox2 = tb2.Text;
string tbox3 = tb3.Text;
string tbox5 = tb5.Text;
string tbox7 = tb7.Text;
string tbox9 = tb9.Text;
string tbox11 = tb11.Text;
string tbox13 = tb13.Text;
string question = "insert into addquest values('" + tbox1 + "' , '" + tbox2 + "','" + tbox3 + "','" + tbox5 + "','" + tbox7 + "','" +
tbox9 + "','" + tbox11 + "','" + tbox13 + "')";
quizsystem addquest = new quizsystem();
addquest.insert(question);
MessageBox.Show("New Question has been Added Successfully", "Success");
addquest.conn.Close();
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
radioButton5.Checked = false;
tb1.Focus();
tb2.Clear();
tb3.Clear();
tb5.Clear();
tb7.Clear();
tb9.Clear();
tb11.Clear();
tb13.Clear();
}
else
{
MessageBox.Show("Must Select the Correct Answer Option", "Denied");
}
}
else
{
MessageBox.Show("Make Sure that all the required lines are fullfilled", "Access Denied");

tb1.Focus();
}

}
catch (Exception)

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 71
QUIZ MANAGEMENT SYSTEM

{
MessageBox.Show("The Question you entered is Already Exist", "Denied");
tb1.Clear();
tb1.Focus();

}
}

}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 72
QUIZ MANAGEMENT SYSTEM

REPORTS
PAPER SHOW REPORT (FORM 8)

Following is the report screen made for teachers, such as print quiz and paper show for the purpose of print reports.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 73
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

//ANSWER SHEET FORM CODE-------PAPER SHOW//

//BACK BUTTON CODE//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

//PAPER SHOW THOUGH STUENT ROLLNO SEARCH ON THIS VIEW BUTTON//

private void button1_Click(object sender, EventArgs e)


{
if (textBox1.Text != "")
{
DataSet ds = new DataSet2();
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=quizsystem2000.mdb");
string str = "select * from answersheet where rolno ='" + textBox1.Text + "'";
OleDbDataAdapter da = new OleDbDataAdapter(str, conn);
da.Fill(ds, "answersheet");
DataTable dt = new DataTable();
answersheet cr1 = new answersheet();
cr1.SetDataSource(ds.Tables["answersheet"]);
crystalReportViewer1.ReportSource = cr1;
}
else
{
MessageBox.Show("Must enter the roll no", "Denied");
textBox1.Clear();
textBox1.Focus();
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 74
QUIZ MANAGEMENT SYSTEM

ANSWER SHEET REPORT(FORM 3)

This is an answer sheet form made for teachers to show in class to students in soft form as well as they can take prints

of answer sheets for further use.

FORM CODING:

//OFFLINE QUIZ PRINT REPORT FORM//

//FOR EDIT QUIZ QUESTIONS----------EDIT BUTTON//

private void button1_Click(object sender, EventArgs e)


{
Form10 obj = new Form10();
obj.Show();
}
//BACK BUTON------CLOSE THE WINDOW//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 75
QUIZ MANAGEMENT SYSTEM

STUDENT RESULT DATA BASE FORM (FORM: 22)


This form is retrieving old quizzes data.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 76
QUIZ MANAGEMENT SYSTEM

CODING OF FORM:

// VIEW BUTTON ---------- SEARCHING STUDENT QUIZ RESULT DATA //

private void button1_Click(object sender, EventArgs e)


{
if (textBox1.Text != "")
{
DataSet ds = new DataSet3();
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=quizsystem2000.mdb");
string str = "select * from marksheetdb where qt ='" + textBox1.Text + "'";
OleDbDataAdapter da = new OleDbDataAdapter(str, conn);
da.Fill(ds, "marksheetdb");
DataTable dt = new DataTable();
studentresultdb cr1 = new studentresultdb();
cr1.SetDataSource(ds.Tables["marksheetdb"]);
crystalReportViewer1.ReportSource = cr1;
}
else
{
MessageBox.Show("Must enter the Quiz Title", "Denied");
textBox1.Clear();
textBox1.Focus();
}
}

// BACK BUTTON---------- TO CLOSE THE WINDOW //

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 77
QUIZ MANAGEMENT SYSTEM

STUDENT SOLVED SHEET FORM (FORM: 23)


This form is retrieving previous quizzes paper show report.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 78
QUIZ MANAGEMENT SYSTEM

CODING OF FORM 23:

//STUDENT PAPER SHOW DATABASE RECORD FORM//

//VIEW BUTTON------------ TO RETRIEVE STUDENT PREVIOUS PAPER SHOW DATABASE//

private void button1_Click(object sender, EventArgs e)


{
if (textBox1.Text != "" || textBox2.Text!="")
{
DataSet ds = new DataSet4();
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=quizsystem2000.mdb");
string str = "select * from answersheetdb where qt ='" + textBox1.Text + "' and rolno='"+textBox2.Text+"'";
OleDbDataAdapter da = new OleDbDataAdapter(str, conn);
da.Fill(ds, "answersheetdb");
DataTable dt = new DataTable();
studentpsdb cr1 = new studentpsdb();
cr1.SetDataSource(ds.Tables["answersheetdb"]);
crystalReportViewer1.ReportSource = cr1;
}
else
{
MessageBox.Show("Must enter the Quiz Title and Roll No", "Denied");
textBox1.Clear();
textBox1.Focus();
}
}

//BACK BUTTON-----------TO CLOSE THE WINDOW//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}
}
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 79
QUIZ MANAGEMENT SYSTEM

MARK SHEET (FORM 20)

Following module is used as mark sheet to display student result.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 80
QUIZ MANAGEMENT SYSTEM

CODING OF THIS FORM:

//STUDENT MARKSHEET REPORT FROM CODING//

//VIEW BUTTON FROM WHERE U CAN SEARCH STUDENT MARK SHEET THROUGH ROLLNO//

private void button1_Click(object sender, EventArgs e)


{
if (textBox1.Text != "")
{
DataSet ds = new DataSet1();

OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=quizsystem2000.mdb");


string str = "select * from marksheet where rolno ='" + textBox1.Text + "'";
OleDbDataAdapter da = new OleDbDataAdapter(str, conn);
da.Fill(ds, "marksheet");
DataTable dt = new DataTable();
marksheet cr1 = new marksheet();

cr1.SetDataSource(ds.Tables["marksheet"]);
crystalReportViewer1.ReportSource = cr1;
}
else
{
MessageBox.Show("Must enter the roll no","Denied");
textBox1.Clear();
textBox1.Focus();
}
}

//BACK BUTTON//

private void button3_Click(object sender, EventArgs e)


{
this.Close();
}

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 81
QUIZ MANAGEMENT SYSTEM

ACCESS DATABASE RECORD SNAPSHOTS

ADD QUESTION IN DATABASE

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 82
QUIZ MANAGEMENT SYSTEM

ANSWER SHEET DATASABE

OLD QUIZZES SOLVED SHEETS DATABASE

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 83
QUIZ MANAGEMENT SYSTEM

CREATE QUIZ TITLE DATABASE

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 84
QUIZ MANAGEMENT SYSTEM

LOGIN DATABASE

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 85
QUIZ MANAGEMENT SYSTEM

MARK SHEET DATABASE

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 86
QUIZ MANAGEMENT SYSTEM

OLD QUIZZES MARKSHEETS DATABASE

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 87
QUIZ MANAGEMENT SYSTEM

CONCLUSION:
We have tried to provided an online and offline solutions for Teachers and students. This

software can easily be deployed in all education institutions for the purpose of quiz

generation and quiz taking system. We have made this system user friendly. It is a best

solution for online and offline Quiz system from our side.

INSTITUTE OF BUSINESS AND INFORMATION TECHNOLOGY


UNIVERSITY OF PUNJAB LAHORE Page 88

You might also like