Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Can't Get Passed First Page!

Posted on 2003-03-15
Medium Priority
Last Modified: 2010-05-01
This is a basic( no pun) question, but it has my head wrecked!!
I have just started on VB and its my first attempt at programming
I Have a learning edition of VB, im trying to write a quiz type program ( hey there's
nothin on TV). I have my first page done, IE, What is blah blah, i have a lits of awnsers,
you pick one hit the enter button and are told it right ( or wrong) .
Now im stuck, how do i go on to the next question,i've tried looking up all the help menus
 i can get me eyes on , but im getting nowhere, i know its simple ( i hope).
Hope you can help,
Kitz E.
Question by:KitzEKat

Expert Comment

ID: 8144176
Well, it depends where your next question is.  If it is in a different frame, you can use the visible properties.

Frame1.visible = false
Frame2.visible = True

Or if it is a form you can do the same thing

Form1.visible = false
Form2.visible = True

I hope this helps.  I don't know if I quite understand what you are doing though.

Author Comment

ID: 8144219
EH thats a good question, what am i trying to do!!
Something along the lines of a simulated exam test ie A+
 type of thing, like i say i have the first "page" done, when you answer that question i want to be able to go on to the next one and so on ,do i do a different page or form for each one ? how do i make the "NEXT Question " button lead to an identical page with a different question,

Accepted Solution

robertlees earned 200 total points
ID: 8144381
Let's say you have stored your questions in a file called Questions.txt. Each question is on one line, and the answer is on the next line.

In Form_Load you write...
   Open app.path & "\Questions.txt" for input as #1
   call GetNextQuestion

Then write a routine...
Sub GetNextQuestion()
   dim strQ as string
   dim strA as string

   if eof(1) then
      msgbox "There are no more questions"
      Line Input #1,strQ
      line input #1,strA
   end if
End Sub

On your form you would have 2 textboxes - one called txtQuestion and the other txtAnswer. Also a command button call cmdReveal and one called cmdNext. Also cmdEnd

sub cmdReveal_Click
end sub

sub cmdNext_click
   call GetNextQuestion
end sub

sub cmdEnd_click
   close #1
end sub

That should do to get you started. You could add stuff like recording their answers, etc
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 8144395
Create two forms (named Form1 and Form2), with a button (Command1) on the first form, and put in this code in Private Sub Command1_Click:
'Insert here your code for testing if the answer is right
Form1.Hide 'you could also do Form1.Visible=False
Form2.Show 'you could also do Form2.Visible=True


Expert Comment

ID: 8144612
This isn't a proposed answer, but just a helpful bit of advice.

If you understand how, and the security of the actual answers is important, then I would suggest putting the questions and answers in a database.

There are many good reasons for doing this.  You don't have to work with files, and since the database is password protected, nobody can see the questions or the answers.


Author Comment

ID: 8144708
Thanks all.
Your advice is goin to put me on the right track, there's a bit more to this BASIC thing than i thought, thanks for your time, i will take your advice on board, it will take sometime to figure it all out, that's the fun bit!!!, but i know you have me on the right track,i may have skipped some of the basics and jumped in too deep, im like that!
Its the only way to fly!
So thanks you guy's for takin the time to help a newbie,
Take It Handy!
And Remember us cats have four paws, we can type fast!!
Just Don't Know what were typin, but hey its fun!!!
Kitz E Kat

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question