By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Help Needed About "Next" Button In Visual Basic!

P: 7
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
Jan 16 '08 #1
Share this Question
Share on Google+
14 Replies


lotus18
100+
P: 866
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?
Jan 16 '08 #2

P: 7
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!
Jan 16 '08 #3

lotus18
100+
P: 866
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
Jan 16 '08 #4

P: 7
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!
Jan 16 '08 #5

Expert 5K+
P: 8,434
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
Jan 16 '08 #6

P: 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.visible = True
btnNext2 = True
End If

If btnNext2 = True Then
lblQuestion2.visible = True
btnNext3 = True
End if

and so on...
Jan 16 '08 #7

jamesd0142
100+
P: 469
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
Jan 16 '08 #8

9815402440
100+
P: 180
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).visible = true
frame(i).zorder vbbringtofront
dim ii as integer
for ii=0 to frame.count-1
if ii <> i then
frame(ii).visible = 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
Jan 16 '08 #9

P: 7
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!
Jan 16 '08 #10

P: 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.visible = True
btnNext2 = True
End If

If btnNext2 = True Then
lblQuestion2.visible = True
btnNext3 = True
End if

and so on...

Sir, I don't need 15 Next buttons, just one!
Jan 16 '08 #11

debasisdas
Expert 5K+
P: 8,127
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.
Jan 16 '08 #12

P: 7
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!
Jan 16 '08 #13

P: 7
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!
Jan 17 '08 #14

P: 1
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!
Sep 4 '12 #15

Post your reply

Sign in to post your reply or Sign up for a free account.