Group Discounts available for 3+ students and Corporate Clients

Code for Delete (button_click) (Manage Question) in

Code for Delete (button_click) (Manage Question)


cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = “Remove Question”

cmd.Parameters.Clear ()

cmd.Parameters.AddWithValue (“@ qid”, txtQuestionId.Text)

if cn.State = ConnectionState.Closed then

ex.Open ()

MessageBox.Show (“Question removed”, Me.Text)

ClearQuestion ()

Catch ex as Exception

MessageBox.Show (ex.Message, “Error”)

End try

Open UserForm (A new WINFORM)

Place pictureBox on Form

Set image = Select image (vb270 Online Examination)

Dock = Top

BackGround = White (Form)

Place a label Untitled Candidate Name



Select Combobox & select use Databound items

Choose vb270Category OE

Display Member: Category Name

Value Member: Category Id

// Code for Formload (Userform)

Untitled Under user form

lblCName.Text = logicForm

Above TakeExam_buttonClick

Public Shared examid as Integer

// For TakeExam btn

‘Take Exam (button_click)

Examid = cmbExam.SelectedValue

Dim ef as New ExamForm

Me.Hide ()

Ef.ShowDialog ()

Me.Dispose ()

// Code for close button_click





Place another Groupbox upon existing are

Place label 2nd Groupbox à Text

Text: Thank you for using vb270 Online Examination

Place label 2 on 2nd Groupbox

Please click on [finish] button to view results

For Groupbox2 – visible = false

For ExamForm_Load

Imports System.Data

Imports System.Data.SqlClient

– Under public class ExamForm

‘Form declarations

Dim cn as SqlConnection

Dim cmd as SqlCommand

Dim dr as SqlDataReader

Public Shared ds as DataSet



Cn = New Sql Connection (“user id = sa; password = 123; database = master; datasource = sekhar”)

Cmd = New SqlCommand

cmd.Connection = cn

cmd.CommandType = CommandType.Text

cmd.CommandText = “Select * from vb270 QuestionsOE where category id=” & userFrom Examid

if cn.State = ConnectionState.closed then cn.Open ()

dr = cmd.ExecuteReader

ds = New Dataset

ds.Tables.Add (“User Response”)

ds.Tables (0).Columns.Add (“Question”)

ds.Tables (0).Columns.Add (“CorrectAnswer”)

ds.Tables (0).Columns.Add (“User Answer”)

ds.Tables (0).Columns.Add (“Status”)

Showquestion ()

Go to ‘Form declarations

Public Sub ShowQuestion ()

If dr.Read = True then

lblQuestion.Text = dr.Getvalue (1)

rbtOption1.Text = dr.GetValue (2)

rbtOption2.Text = dr.GetValue (3)

rbtOption3.Text = dr.GetValue (4)

rbtOption4.Text = dr.GetValue (5)


btnNext.Enabled = False

btnFinish.Enabled = True

GroupBoxQuestion.Visible = False

GroupBoxFinal.Visible = True

End if

End sub

// Code for ‘Next (button_click)

SetUserResponse ()

ShowQuestion ()

Again go to ‘Form declarations (exam form)

Public row SetUserResponse ()

Dim row as DataRow

row = ds.Tables (0).NewRow

row (0) = lblQuestion.Text

Select case dr.GetValue (6)

Case ls =1

Row (1) = rbtOption1.Text

Case ls = 2

Row (2) = rbtOption2.Text

Case ls = 3

Row (3) = rbtOption3.Text

Case ls = 4

Row (4) = rbtOption4.Text

End select

If rbtOption1.Checked then row (2) = rbtOption1.Text

If rbtOption2.Checked then row (2) = rbtOption2.Text

If rbtOption3.Checked then row (2) = rbtOption3.Text

If rbtOption4.Checked then row (2) = rbtOption4.Text

If row (1) = row (2) then

Row (3) = “Correct”


Row (3)

End if

ds.Tables (0).Rows.Add (row)

rbtOption1.Checked = False

rbtOption2.Checked = False

rbtOption3.Checked = False

rbtOption4.Checked = False

End sub


// Code for Finish_button

Dim rf as ResultsForm

Me.Hide ()

rf.ShowDialog ()

Me.Dispose ()

Project (menu) Untitled Add new form Untitled Results Form




‘Form Load (ResultsForm

lblName.Text = LoginForm.user

DataGridView1.DataSource = ExamForm.ds.Tables (0)

Dim totalQuestions, correctAnswers as Integer

totalQuestions = ExamForm.ds.Tables (0).Rows.Count

CorrectAnswers = 0

For r as Integer = 0 to

ExamForm.ds.Tables (0).Rows (r) (3) = “Correct” then

CorrectAnswers + = 1


Dim Percentage as integer

Percentage = (CorrectAnswers * 100) / totalQuestions

Lbl CandidateScore.Text = String.Format (“Candidate Score ({0} marks)”, percentage)

If percentage > = 85 then

Lbl Result.text = “Pass”

lblResult.FOreColor = Color.Green

loginForm.AxAgent1.Characters (“Merlin”).Play (“Announce”)

loginForm.AxAgent1.Characters (“Merlin”).Play (“Congratulate_2”)

loginForm.AxAgent1.Characters (“Merlin”).Speak(String.Format (“Congrts {0} you have passed”, lblName.Text))


lblResult.Text = “Fail”

lblResult.ForeColor = Color.Red

LoginForm.AxAgent1.Characters (“Merlin”).Play (“Sad”)

LoginForm.AxAgent1.Characters (“Merlin”).Speak (“Better luck next time” & lblName.Text)

End if

progressBarUsersCore.Value = Percentage



“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at, we will update the article in 24 hours.”

0 Responses on Code for Delete (button_click) (Manage Question) in"

Leave a Message

Your email address will not be published. Required fields are marked *


Please Enter Your Details and Query.
Three + 6