NEXT and PREVIOUS btn HELP

Can someone please help me I have a program due I have to create a multiple choice test, and I dont know how to write the code for making a NEXT button work on my program.. Please help I am willing to pay! Please contact me ASAP for more detail.

Comments

  • Is the Next Button's function only to move on to the next question or does it have to do validation of current answer, increment scoring, etc, as well?


  • Yes it is to move on to the next page. I am also having a problem with getting the answers from the testee to tally up at the end of the program.

    : Is the Next Button's function only to move on to the next question or does it have to do validation of current answer, increment scoring, etc, as well?
    :
    :
    :

  • : Yes it is to move on to the next page. I am also having a problem with getting the answers from the testee to tally up at the end of the program.
    :

    With no picture of what you've done so far or how you have structured it, I'm sure you'll understand that I can only give you general pointers - basically my best guess as to what you are doing and what you need :-)

    >> it is to move on to the next page
    [code]
    Dim f2 as new Form2
    f2.Show
    [/code]
    This creates an instance of the next page and shows it.


    >> having a problem with getting the answers from the testee to tally up at the end of the program.

    If the problem is one of finding a way of keeping track of the running total, then you can create a Friend scope variable in a Module and this will be visible to all Forms and Modules in your whole project.
    [code]
    Friend Module1
    Friend TotalScore as Integer
    ' Other module code here
    End Module

    ' In the forms
    If then TotalScore += 1
    [/code]

    Obviously I don't know how you are displaying the answer choices, so can't complete the code that validates correct/incorrect status.

    Let me know if I've misunderstood any of your questions and, where appropriate, give me an idea of how you're approaching the task.

    Ged

  • Ged,

    First let me say thank you so much for repling.

    Let me give you a better idea of what it is I need help with.

    I have 4 forms. On the 1st page there is a welcome message where the user enters their name and the date is shown, this page tells the user about the test. The 2nd page has 5 true/false questions where the user reads the question and has to pick the answer. The third page has 5 multiple choice questions where again the user has to answer the question by clicking the correct radio button. The 4th and final page is suppose to show the user the correct answers, the answers that they choice and what their score is based on getting 10 points with every correct question. I have designed the program based on the information that I stated above. I am having problems getting my NEXT and PREVIOUS buttons to work so that the user can go from page to page and I am also have problems with the tallying of the points. If you can suggest an easier way please I am all ears if not I will use what you suggested.

    Thanks so much again.. Melinda

    : : Yes it is to move on to the next page. I am also having a problem with getting the answers from the testee to tally up at the end of the program.
    : :
    :
    : With no picture of what you've done so far or how you have structured it, I'm sure you'll understand that I can only give you general pointers - basically my best guess as to what you are doing and what you need :-)
    :
    : >> it is to move on to the next page
    : [code]
    : Dim f2 as new Form2
    : f2.Show
    : [/code]
    : This creates an instance of the next page and shows it.
    :
    :
    : >> having a problem with getting the answers from the testee to tally up at the end of the program.
    :
    : If the problem is one of finding a way of keeping track of the running total, then you can create a Friend scope variable in a Module and this will be visible to all Forms and Modules in your whole project.
    : [code]
    : Friend Module1
    : Friend TotalScore as Integer
    : ' Other module code here
    : End Module
    :
    : ' In the forms
    : If then TotalScore += 1
    : [/code]
    :
    : Obviously I don't know how you are displaying the answer choices, so can't complete the code that validates correct/incorrect status.
    :
    : Let me know if I've misunderstood any of your questions and, where appropriate, give me an idea of how you're approaching the task.
    :
    : Ged
    :
    :

  • No problem. Happy to help if I can.

    One of the easiest ways of allowing the flipping backwards and forwards between forms (without creating lots of additional copies that you don't want) is to do this.

    Put code like this in a Module:
    [code]
    Friend Module Module1
    Friend f1 As New Form1
    Friend f2 As New Form2
    Friend f3 As New Form3

    Friend TotalScore As Integer


    Sub Main()
    Application.Run(f1)
    End Sub
    End Module
    [/code]
    What this does is creates an instance of each of the forms right at the start. You can then access any of them from any other form by referring to the form variable names assigned to them - eg. F1 , F2, etc.

    The TotalScore variable will be used later to keep track of scores. We'll come back to that.

    The Sub Main is crucial. What it does is to tell your application to begin by running Form1. (Yep, I know it would do this anyway, but doing it this way allows you to access the F1 form instance when you need to while the app is running.

    Another important change you need to make is this. Open the Project's Properties and change the StartUp Object from Form1 (the default) to Sub Main - which will be one of the choices you are given.

    OK so far?

    Now put this code in the click event of the 'Next' button on Form1
    [code]
    f2.Show()
    Me.Hide()
    [/code]
    I think you can see how that works. :-)

    Similar code in each of the other forms, except that you change the f2 to f3, f4, etc for each new form.

    Forms 2, 3, 4, etc will also have a 'Previous' button. Put this code in the click event of that button
    [code]
    ' This example is for Form2
    f1.Show() ' Previous form
    Me.Hide()
    [/code]
    Similar code in each of the other forms, again changing the name of the form variable of the form that you want to display.

    So that should sort out the Next/Previous problem for you.

    Score Tallying. When you check the user's answer, increment the TotalScore variable by 10 for each correct one.
    [code]
    TotalScore += 10
    [/code]
    At the end of the quiz, TotalScore will hold the , umm, total score :-)

    You can deduct from the score if you want to.

    It sounds like you have code to store the questions, answer choices and correct answer details.

    So the only other thing you need to build in is a way of letting the user close down the application. Add an Exit or Finished button on the last page (or any pages you like). Put this code in the button click
    [code]
    Application.Exit()
    [/code]

    Is that you sorted now ?






  • You are the greatest thanks so much I will enter what you gave me and tell you how it turned out. Thanks again .

    : No problem. Happy to help if I can.
    :
    : One of the easiest ways of allowing the flipping backwards and forwards between forms (without creating lots of additional copies that you don't want) is to do this.
    :
    : Put code like this in a Module:
    : [code]
    : Friend Module Module1
    : Friend f1 As New Form1
    : Friend f2 As New Form2
    : Friend f3 As New Form3
    :
    : Friend TotalScore As Integer
    :
    :
    : Sub Main()
    : Application.Run(f1)
    : End Sub
    : End Module
    : [/code]
    : What this does is creates an instance of each of the forms right at the start. You can then access any of them from any other form by referring to the form variable names assigned to them - eg. F1 , F2, etc.
    :
    : The TotalScore variable will be used later to keep track of scores. We'll come back to that.
    :
    : The Sub Main is crucial. What it does is to tell your application to begin by running Form1. (Yep, I know it would do this anyway, but doing it this way allows you to access the F1 form instance when you need to while the app is running.
    :
    : Another important change you need to make is this. Open the Project's Properties and change the StartUp Object from Form1 (the default) to Sub Main - which will be one of the choices you are given.
    :
    : OK so far?
    :
    : Now put this code in the click event of the 'Next' button on Form1
    : [code]
    : f2.Show()
    : Me.Hide()
    : [/code]
    : I think you can see how that works. :-)
    :
    : Similar code in each of the other forms, except that you change the f2 to f3, f4, etc for each new form.
    :
    : Forms 2, 3, 4, etc will also have a 'Previous' button. Put this code in the click event of that button
    : [code]
    : ' This example is for Form2
    : f1.Show() ' Previous form
    : Me.Hide()
    : [/code]
    : Similar code in each of the other forms, again changing the name of the form variable of the form that you want to display.
    :
    : So that should sort out the Next/Previous problem for you.
    :
    : Score Tallying. When you check the user's answer, increment the TotalScore variable by 10 for each correct one.
    : [code]
    : TotalScore += 10
    : [/code]
    : At the end of the quiz, TotalScore will hold the , umm, total score :-)
    :
    : You can deduct from the score if you want to.
    :
    : It sounds like you have code to store the questions, answer choices and correct answer details.
    :
    : So the only other thing you need to build in is a way of letting the user close down the application. Add an Exit or Finished button on the last page (or any pages you like). Put this code in the button click
    : [code]
    : Application.Exit()
    : [/code]
    :
    : Is that you sorted now ?
    :
    :
    :
    :
    :
    :
    :

  • I am working on something similar and have been trying to follow along, however, I am unable to get the totalscore to calculate correctly. What did you come up with?



    : You are the greatest thanks so much I will enter what you gave me and tell you how it turned out. Thanks again .
    :
    : : No problem. Happy to help if I can.
    : :
    : : One of the easiest ways of allowing the flipping backwards and forwards between forms (without creating lots of additional copies that you don't want) is to do this.
    : :
    : : Put code like this in a Module:
    : : [code]
    : : Friend Module Module1
    : : Friend f1 As New Form1
    : : Friend f2 As New Form2
    : : Friend f3 As New Form3
    : :
    : : Friend TotalScore As Integer
    : :
    : :
    : : Sub Main()
    : : Application.Run(f1)
    : : End Sub
    : : End Module
    : : [/code]
    : : What this does is creates an instance of each of the forms right at the start. You can then access any of them from any other form by referring to the form variable names assigned to them - eg. F1 , F2, etc.
    : :
    : : The TotalScore variable will be used later to keep track of scores. We'll come back to that.
    : :
    : : The Sub Main is crucial. What it does is to tell your application to begin by running Form1. (Yep, I know it would do this anyway, but doing it this way allows you to access the F1 form instance when you need to while the app is running.
    : :
    : : Another important change you need to make is this. Open the Project's Properties and change the StartUp Object from Form1 (the default) to Sub Main - which will be one of the choices you are given.
    : :
    : : OK so far?
    : :
    : : Now put this code in the click event of the 'Next' button on Form1
    : : [code]
    : : f2.Show()
    : : Me.Hide()
    : : [/code]
    : : I think you can see how that works. :-)
    : :
    : : Similar code in each of the other forms, except that you change the f2 to f3, f4, etc for each new form.
    : :
    : : Forms 2, 3, 4, etc will also have a 'Previous' button. Put this code in the click event of that button
    : : [code]
    : : ' This example is for Form2
    : : f1.Show() ' Previous form
    : : Me.Hide()
    : : [/code]
    : : Similar code in each of the other forms, again changing the name of the form variable of the form that you want to display.
    : :
    : : So that should sort out the Next/Previous problem for you.
    : :
    : : Score Tallying. When you check the user's answer, increment the TotalScore variable by 10 for each correct one.
    : : [code]
    : : TotalScore += 10
    : : [/code]
    : : At the end of the quiz, TotalScore will hold the , umm, total score :-)
    : :
    : : You can deduct from the score if you want to.
    : :
    : : It sounds like you have code to store the questions, answer choices and correct answer details.
    : :
    : : So the only other thing you need to build in is a way of letting the user close down the application. Add an Exit or Finished button on the last page (or any pages you like). Put this code in the button click
    : : [code]
    : : Application.Exit()
    : : [/code]
    : :
    : : Is that you sorted now ?
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    :
    :

  • Hi
    Did you see the code I posted in one of the earlier posts where the TotalScore variable is created in a module? If not, that's probably the bit you are missing.

    If you did, and have implemented that, then can you give more detail of where you are having problems with score tallying?


    Ged


    ===================================================================


    : I am working on something similar and have been trying to follow along, however, I am unable to get the totalscore to calculate correctly. What did you come up with?
    :
    :
    :: : :
    : : : Score Tallying. When you check the user's answer, increment the TotalScore variable by 10 for each correct one.
    : : : [code]
    : : : TotalScore += 10
    : : : [/code]
    : : : At the end of the quiz, TotalScore will hold the , umm, total score :-)

  • Ged

    Thanks for the help. I went back through your messages and got the program to work.

    JanTin


    : Hi
    : Did you see the code I posted in one of the earlier posts where the TotalScore variable is created in a module? If not, that's probably the bit you are missing.
    :
    : If you did, and have implemented that, then can you give more detail of where you are having problems with score tallying?
    :
    :
    : Ged
    :
    :
    : ===================================================================
    :
    :
    : : I am working on something similar and have been trying to follow along, however, I am unable to get the totalscore to calculate correctly. What did you come up with?
    : :
    : :
    : :: : :
    : : : : Score Tallying. When you check the user's answer, increment the TotalScore variable by 10 for each correct one.
    : : : : [code]
    : : : : TotalScore += 10
    : : : : [/code]
    : : : : At the end of the quiz, TotalScore will hold the , umm, total score :-)
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories