Help Needed About "Next" Button In Visual Basic!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • princedhump
    New Member
    • Jan 2008
    • 7

    Help Needed About "Next" Button In Visual Basic!

    Hi everyone, I am making a game in Visual Basic. I need some help with it.
    My question is: that when the user would click the Next button on the Form, the next Question should show! I have 15 Questions to show. How can I do that. It's my exam, and I really need your help!

    Regards
    Prince Dhump
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    Originally posted by princedhump
    Hi everyone, I am making a game in Visual Basic. I need some help with it.
    My question is: that when the user would click the Next button on the Form, the next Question should show! I have 15 Questions to show. How can I do that. It's my exam, and I really need your help!

    Regards
    Prince Dhump
    Can you show us what have you done so far?

    Comment

    • princedhump
      New Member
      • Jan 2008
      • 7

      #3
      Thank you for replying sir, but we are making at school, we can't open it on our home computers! Please sir, I would really appreciate if you help! It's my first time taking VB so, I am not really fimiliar with it! PLease!

      Comment

      • lotus18
        Contributor
        • Nov 2007
        • 865

        #4
        Originally posted by princedhump
        Thank you for replying sir, but we are making at school, we can't open it on our home computers! Please sir, I would really appreciate if you help! It's my first time taking VB so, I am not really fimiliar with it! PLease!
        Hi

        Don't call me sir. I only just a student like you, and I'm still learning. Do the questions are randomly viewed or they are in sequence?

        Rey Sean

        Comment

        • princedhump
          New Member
          • Jan 2008
          • 7

          #5
          Hello,

          Basically, it's like:
          Question: For example, What is Canada's biggest city?
          Option Buttons, to select from.
          User is done with that!
          They would click Next, so I want my next Question, which would be in the same label box as the previous question and Options would also be on the previous Option Buttons, but, of course different question and options each time.
          I hope, I am able to explain properly!
          I just have 15 questions, so they could display in any way, but just have to display all of them, as user goes on and click Next!
          For each Next, one Question should be displayed!

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

            Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

            Then when you are ready post a new question in this thread.

            MODERATOR

            Comment

            • brenty66
              New Member
              • Jan 2008
              • 7

              #7
              Write out all 15 of the questions you want on the form. Then place your "Next" button after each question. On the properties window (left side) where it says visible: True (do this for each question and button). Change them to false.
              . Encode into your btnNext click procedure this:
              If btnNext = True Then
              lblQuestion.vis ible = True
              btnNext2 = True
              End If

              If btnNext2 = True Then
              lblQuestion2.vi sible = True
              btnNext3 = True
              End if

              and so on...

              Comment

              • jamesd0142
                Contributor
                • Sep 2007
                • 471

                #8
                Im sure using an array would be a good option, then the next button could just change the label.text to the next value in the array.

                such as:
                i = i +1
                label1.text = myarray(i)

                obviously you need to validate a few more things, for example check the array has another value etc.

                Another option i would prob be tempted to use however is a small database, you could store the question and answer with an id field all in one place. and load them as you need to.

                Thanks

                Comment

                • 9815402440
                  New Member
                  • Oct 2007
                  • 180

                  #9
                  hi
                  you can use array of frames
                  draw a frame set its index property to 0.
                  make its 18 copies (to accomodate 18 questions). set all frames visible false
                  now add label for question and option buttons for answer in each frame

                  add two command buttons for Next and Previous
                  add following code in Next button

                  i = i +1 'declared at form level and inialized to -1 in form_load event
                  frame(i).visibl e = true
                  frame(i).zorder vbbringtofront
                  dim ii as integer
                  for ii=0 to frame.count-1
                  if ii <> i then
                  frame(ii).visib le = false
                  endif
                  next

                  add same code in Previous button, but decrease value of i
                  this code will give you error on last frame in case you click next button on first frame in case previous button is clicked repeatedly. you have to handle these errors

                  regards
                  manpreet singh dhillon hoshiarpur
                  Last edited by 9815402440; Jan 16 '08, 10:47 AM. Reason: correction

                  Comment

                  • princedhump
                    New Member
                    • Jan 2008
                    • 7

                    #10
                    Thank you for your replies, sir it's my project, but I did it myself the whole thing, I am just unable to show my all 15 questions in one label box and their options in the same option buttons when click on the next button, this is a specific thing I am having trouble with!

                    So, I just need guideline with this:

                    When I would click on the Next button, the next Question should display in the Label box. Click again, then the next should, so on. I hope you would help me experts!

                    Comment

                    • princedhump
                      New Member
                      • Jan 2008
                      • 7

                      #11
                      Write out all 15 of the questions you want on the form. Then place your "Next" button after each question. On the properties window (left side) where it says visible: True (do this for each question and button). Change them to false.
                      . Encode into your btnNext click procedure this:
                      If btnNext = True Then
                      lblQuestion.vis ible = True
                      btnNext2 = True
                      End If

                      If btnNext2 = True Then
                      lblQuestion2.vi sible = True
                      btnNext3 = True
                      End if

                      and so on...

                      Sir, I don't need 15 Next buttons, just one!

                      Comment

                      • debasisdas
                        Recognized Expert Expert
                        • Dec 2006
                        • 8119

                        #12
                        the best solution is to
                        1.store th equestions and its corresponding options in a database.
                        2.establish the connection to database from vb.
                        3.open the recordset
                        4.move to the next record on next button click event.

                        Comment

                        • princedhump
                          New Member
                          • Jan 2008
                          • 7

                          #13
                          Sir, it's Grade 10 VB course. First time I am taking it, we are using VB version 6.
                          I just need the simple Code for this "Next" button, so when I click it, my 15 Questions are shown one by one. One question shown each time, when I click "Next" button!

                          Comment

                          • princedhump
                            New Member
                            • Jan 2008
                            • 7

                            #14
                            Please Experts help me, I really need it. Believe me, I tried many ways, but I can't figure out how to do it. Please for God sake, provide me a small code for it. I will be very greatful to you!

                            Comment

                            • EMDEELF
                              New Member
                              • Sep 2012
                              • 1

                              #15
                              Even though this thread is 4 years old, I thought it might be helpful for the ones after us.
                              First of all being this kind of pushy on a public forum is rude. We all volunteer to help out. We all got got a job, family, etc. to take care of. So be patient next time (if you don't have time, find it on your own, that's what programming is about and not just copy/pasting scripts)

                              More than enough solutions, which work were posted. There is no simple way of just having one "next"-Button. Every button has a static function assignment. A workaround would definetly be @debasisdas solution. Still the button has only static functions assigned to it!

                              Comment

                              Working...