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

x
?
Solved

Can't Get Passed First Page!

Posted on 2003-03-15
6
Medium Priority
?
146 Views
Last Modified: 2010-05-01
Hi,
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,
Thanks
Kitz E.
0
Comment
Question by:KitzEKat
6 Comments
 
LVL 2

Expert Comment

by:Jacamar
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.
0
 

Author Comment

by:KitzEKat
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,
0
 
LVL 1

Accepted Solution

by:
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"
   else
      Line Input #1,strQ
      line input #1,strA
      txtQuestion.txt=strQ
      txtAnswer.text=strA
      txtAnswer.visible=false
   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
   txtAnswer.visible=true
end sub

sub cmdNext_click
   call GetNextQuestion
end sub

sub cmdEnd_click
   close #1
   end
end sub

That should do to get you started. You could add stuff like recording their answers, etc
0
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

by:Jivlain
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


0
 
LVL 1

Expert Comment

by:Amerist
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.

0
 

Author Comment

by:KitzEKat
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!!!
Thanks
Kitz E Kat
0

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