Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

VB Question


  • Please log in to reply

#1
Espresso1

Espresso1

    New Member

  • Member
  • Pip
  • 3 posts
If anyone knows vb can you please help me out?

For computer class im trying to make a quiz but im totally lost on how the code works.

The quiz is true and false.

I would really appreciate the help guys! Please and thanks :tazz:
  • 0

Advertisements


#2
gust0208

gust0208

    Member

  • Member
  • PipPipPip
  • 311 posts
Hello,

We are going to need a bit more information on what you are trying to do. Can you provide us with the code you have written so far and some specific questions of examples in the code that you don't understand and we can work through together? It has been discussed on this forum before that we won't complete homework for you, but are more than happy to help you understand the code and debug what you have done.

Cheers,
Tom

If anyone knows vb can you please help me out?

For computer class im trying to make a quiz but im totally lost on how the code works.

The quiz is true and false.

I would really appreciate the help guys! Please and thanks :tazz:


  • 0

#3
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
I was gonna show you how to make a quiz...but i was writing everything i found out it would take me hours...so i won't, sorry, but i don't have the time.

Anyway, if you have already worked with VB and have some script already, then show it to us and we'll help you.

Otherwise, try to learn the basics off of one of the tutorials on the top of the page! :tazz:
  • 0

#4
Espresso1

Espresso1

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
Ok here is the code I've written so far. When I get the question right I made it so a message pops up in the lblMessage.Caption.

What I'm basically trying to figure out is when I click the Next button I want the quiz to go onto the next question but I dont want to create another form. Im trying to create 5 questions. Now here's the code:
Dim t1 As Integer
Dim f1 As Integer

Private Sub cmdCheckQ1_Click()
If optFalse.Value = True Then
t1 = t1
f1 = f1 + 1
lblMessage.Caption = "You have " & f1 & " questions right!" & "You have " & t1 & " questions wrong!"
End If
End Sub

Private Sub cmdExit_Click()
frmQuiz.Hide
frmMain.Show
End Sub





and here is an image of what the project looks like so far: Posted Image
  • 0

#5
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
Dim t1 As Integer
Dim f1 As Integer

Private Sub cmdCheckQ1_Click()
If optFalse.Value = True Then
t1 = t1
f1 = f1 + 1
lblMessage.Caption = "You have " & f1 & " questions right!" & "You have " & t1 & " questions wrong!"
End If
End Sub

Private Sub cmdExit_Click()
frmQuiz.Hide
frmMain.Show
End Sub

Seems alright to me :)

Does it work?

p.s. try adding a & vbCrLf & between the Right answers and the wrong ones.. :)

Example:

lblMessage.Caption = "You have " & f1 & " questions right!" & vbCrLf & "You have " & t1 & " questions wrong!"

So it would show up as:

You have ... questions right!
You have ... questions wrong!


So it improves visibility... :tazz:

Edited by MaverickSidewinder, 16 December 2005 - 05:44 AM.

  • 0

#6
Espresso1

Espresso1

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
Thanks MaverickSidewinder. But how do I make it so that the quiz game goes onto the next question without me making a new form? Any help is appreciated!
  • 0

#7
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
I was actually thinking about that...what i would do (which takes more work) is to make a lot of different forms, one for each question, and when you press the "Next" button on the code for the button you had:

Me.Hide
frmBlaBla.Show

To get information from another form you have to do: frmblabla!lblResults.Caption ecc.

So that you can get the score from the previous form.
  • 0

#8
Ctrl_Alt_Del

Ctrl_Alt_Del

    Member

  • Member
  • PipPip
  • 74 posts
Make an array of labels for your test questions. When you click the next button then hide the current label, index the index of the array by 1 and then make the new label visible. You can use the same true false option buttons and store the number of correct answers in global variables. The last label in your array of labels will display the score of the quiz.
  • 0

#9
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Knock Knock, still need help?

Array is a good idea, but there is no point in making arrays of labels etc.

Just do this: Make an array of string named Questions. Then fill in the questions and then after clicking 'Next question', set the label's caption to the value of the next question

Dim questions(20) As String

'somewhere later
lblQuestion.Caption = questions(thisQuestion + 1)

I don't know the names, I didn't read the previous codes.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP