Vb helppp :(
Vb helppp :(
Vb helppp :(
Vb helppp :(
Vb helppp :(
Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :(
Vb helppp :( Vb helppp :(
Vb helppp :(
Go Back  Xtreme Visual Basic Talk > > > Vb helppp :(


Reply
 
Thread Tools Display Modes
  #1  
Old 05-19-2012, 08:50 PM
bubblegum2 bubblegum2 is offline
Newcomer
 
Join Date: May 2012
Posts: 2
Post Vb helppp :(


We are creating are you smarter than a fifth grader and we have to use a two dimensional array for the questions and choices so here is what we have so far:

gr3questionschoices(0, 0) = "Astronomy: Which planet is the closest to sun?"
gr3questionschoices(0, 1) = "Mars"
gr3questionschoices(0, 2) = "Saturn"
gr3questionschoices(0, 3) = "Jupiter"
gr3questionschoices(0, 4) = "Uranus"
gr3questionschoices(1, 0) = "Geogarphy: Which one of these is not one of the great lakes?"
gr3questionschoices(1, 1) = "Superior"
gr3questionschoices(1, 2) = "Alberta"
gr3questionschoices(1, 3) = "Ontario"
gr3questionschoices(1, 4) = "Huron"
gr3questionschoices(2, 0) = "Astronomy: Who was the first person to land on the moon?"
gr3questionschoices(2, 1) = "Ian Somerhalder"
gr3questionschoices(2, 2) = "Neil Armstrong"
gr3questionschoices(2, 3) = "Brad Pitt"
gr3questionschoices(2, 4) = "Thomas Edison"
gr3questionschoices(3, 0) = "Grammer: What type of word is carefully?"
gr3questionschoices(3, 1) = "Noun"
gr3questionschoices(3, 2) = "adverb"
gr3questionschoices(3, 3) = "adjective"
gr3questionschoices(3, 4) = "verb"
gr3questionschoices(4, 0) = "Animal Science: What type of animal is a turtle?"
gr3questionschoices(4, 1) = "mammel"
gr3questionschoices(4, 2) = "bird"
gr3questionschoices(4, 3) = "insect"
gr3questionschoices(4, 4) = "reptile"
gr3questionschoices(5, 0) = "World Geography: Who came up with the theory of Continental drift?"
gr3questionschoices(5, 1) = "Alfred Wagner"
gr3questionschoices(5, 2) = "Albert Einstine"
gr3questionschoices(5, 3) = "Mark Antony"
gr3questionschoices(5, 4) = "Thomas Edison"
gr3questionschoices(6, 0) = "World History: Who was the first women to get arrested for voting?"
gr3questionschoices(6, 1) = "Rosa Parks"
gr3questionschoices(6, 2) = "Harriet Tubmen"
gr3questionschoices(6, 3) = "Susanne B. Antony"
gr3questionschoices(6, 4) = "Anne Frank"
gr3questionschoices(7, 0) = "Geography: Which era was the dinosarus from?"
gr3questionschoices(7, 1) = "Mesozoic"
gr3questionschoices(7, 2) = "Paleozoic"
gr3questionschoices(7, 3) = "Cenezoic"
gr3questionschoices(7, 4) = "Pre cambrian"
gr3questionschoices(8, 0) = "Geography:Which of these continents is a natural habitat?"
gr3questionschoices(8, 1) = "Australia"
gr3questionschoices(8, 2) = "Asia"
gr3questionschoices(8, 3) = "Africa"
gr3questionschoices(8, 4) = "South America"
gr3questionschoices(9, 0) = "Math: What is the lowest prime number?"
gr3questionschoices(9, 1) = "0"
gr3questionschoices(9, 2) = "2"
gr3questionschoices(9, 3) = "1"
gr3questionschoices(9, 4) = "4"


For questions = 0 To 9
gr4questionschoices(questions, 0) = CInt(Rnd() * 9)
Label1.Text = gr4questionschoices(questions, 0)
RadioButton1.Text = gr3questionschoices(questions, 1)
RadioButton2.Text = gr3questionschoices(questions, 2)
RadioButton3.Text = gr3questionschoices(questions, 3)
RadioButton4.Text = gr3questionschoices(questions, 4)

We cant seem to figure out how to put the questions in a label. The questions are (0,0), (1,0) and so on. The rest are the choices. The choices also has to come in a radio button and the questions should also be randomized.
Were very new at this so its very hard to figure it out so please help
Reply With Quote
  #2  
Old 05-20-2012, 10:00 AM
Gruff's Avatar
GruffVb helppp :( Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

You posted this in web programming. What tool are you using? Visual Studio.Net?

Before you bother writing code you need to write an outline or blueprint of what you want to build.
If you do this step correctly writing the code falls into place easily.

You are building a questionare.

So in general It needs:

1) A place to store the questions and related answers.
2) A way to grab a question & answer group at random but only once per session.
3) Some way of identifying the correct answer.
4) Perhaps some way of keeping score (With a reset)
5) Perhaps some method of storing a score per user.

For the GUI (Graphical User interface)

1) A start (or reset) button.
2) A label to display a question.
3) A Set of four radio buttons to display answers.
4) Perhaps a Label to display "Correct or incorrect"
5) Perhaps a button to draw a new question.
6) Perhaps a color change of a radio button to indicate the correct choice.

This is just an example. You need to create your own lists.
After creating your General lists create a chronilogical list of steps
the user would take to use your software

At this point you should be able to flesh out your chronilogical list with
pseudo code as to how the program will actually work.

Armed with the above information you are now ready to write your program.

------

Incidentally if I were writing such a program I would use a one dimensional
Array of stings where each line contained Question, Answer, and incorrect answers
all separated by a unique character. Perhaps a Tilde.

This format is easy to "Store / Edit / Append" in a text file.

Randomly select an offset to get your Q&A group. Split the result by your unique character.
You now have a short array of strings contaning:

s(0) = Question
s(1) = Correct Answer
s(2) = Incorrect Answer
s(3) = Incorrect Answer
s(4) = Incorrect Answer

Use random again to scramble the four answers into your radio buttons.
You can compare the users choice against s(1)

You might also consider using a udt or class to store your array data instead of a string. (Depending on your VB type)
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 05-20-2012 at 10:09 AM.
Reply With Quote
  #3  
Old 05-20-2012, 06:02 PM
hDC_0Vb helppp :( hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 559
Default coding language?

Quote:
Originally Posted by Gruff
You posted this in web programming. What tool are you using?
I would ask:
"What language are you using?

I'm guessing VBScript since it has booth "CInt" and "Rnd".

Have you tried using "Label1.Caption" instead of "Label1.Text"?
There's some VBScript on this MSDN page that suggests Caption
might be the property to set a text string value for a label.

If you are using ActiveX control objects, the Caption property is also used for
setting the value of labels as detailed on this page.

The other way is to use VBScript with ASP to actually have a database of questions.
This pdf tutorial explains how and the output looks something like this.

Note: VBScript has some limitations and annoyances when it comes to multidimensional arrays. Most of these shouldn't be a issue with the way you have your
arrays set up right now but just something to be aware of in the future.
Reply With Quote
  #4  
Old 05-20-2012, 10:48 PM
bubblegum2 bubblegum2 is offline
Newcomer
 
Join Date: May 2012
Posts: 2
Default

Yes im using vb 2008
We cant use 1d array cuz we have to use two d arrays
How can you make the questions randomize ?
When ever i click play, the same question keeps popping up which is the last question of the array
Reply With Quote
  #5  
Old 05-21-2012, 07:49 AM
TRSDOSBasic79's Avatar
TRSDOSBasic79 TRSDOSBasic79 is offline
Contributor
 
Join Date: Oct 2003
Location: Pennsylvania
Posts: 422
Default

Quote:
Originally Posted by bubblegum2 View Post
We are creating are you smarter than a fifth grader and we have to use a two dimensional array for the questions and choices so here is what we have so far:

gr3questionschoices(0, 0) = "Astronomy: Which planet is the closest to sun?"
gr3questionschoices(0, 1) = "Mars"
gr3questionschoices(0, 2) = "Saturn"
gr3questionschoices(0, 3) = "Jupiter"
gr3questionschoices(0, 4) = "Uranus"
gr3questionschoices(1, 0) = "Geogarphy: Which one of these is not one of the great lakes?"
gr3questionschoices(1, 1) = "Superior"
gr3questionschoices(1, 2) = "Alberta"
gr3questionschoices(1, 3) = "Ontario"
gr3questionschoices(1, 4) = "Huron"
gr3questionschoices(2, 0) = "Astronomy: Who was the first person to land on the moon?"
gr3questionschoices(2, 1) = "Ian Somerhalder"
gr3questionschoices(2, 2) = "Neil Armstrong"
gr3questionschoices(2, 3) = "Brad Pitt"
gr3questionschoices(2, 4) = "Thomas Edison"
gr3questionschoices(3, 0) = "Grammer: What type of word is carefully?"
gr3questionschoices(3, 1) = "Noun"
gr3questionschoices(3, 2) = "adverb"
gr3questionschoices(3, 3) = "adjective"
gr3questionschoices(3, 4) = "verb"
gr3questionschoices(4, 0) = "Animal Science: What type of animal is a turtle?"
gr3questionschoices(4, 1) = "mammel"
gr3questionschoices(4, 2) = "bird"
gr3questionschoices(4, 3) = "insect"
gr3questionschoices(4, 4) = "reptile"
gr3questionschoices(5, 0) = "World Geography: Who came up with the theory of Continental drift?"
gr3questionschoices(5, 1) = "Alfred Wagner"
gr3questionschoices(5, 2) = "Albert Einstine"
gr3questionschoices(5, 3) = "Mark Antony"
gr3questionschoices(5, 4) = "Thomas Edison"
gr3questionschoices(6, 0) = "World History: Who was the first women to get arrested for voting?"
gr3questionschoices(6, 1) = "Rosa Parks"
gr3questionschoices(6, 2) = "Harriet Tubmen"
gr3questionschoices(6, 3) = "Susanne B. Antony"
gr3questionschoices(6, 4) = "Anne Frank"
gr3questionschoices(7, 0) = "Geography: Which era was the dinosarus from?"
gr3questionschoices(7, 1) = "Mesozoic"
gr3questionschoices(7, 2) = "Paleozoic"
gr3questionschoices(7, 3) = "Cenezoic"
gr3questionschoices(7, 4) = "Pre cambrian"
gr3questionschoices(8, 0) = "Geography:Which of these continents is a natural habitat?"
gr3questionschoices(8, 1) = "Australia"
gr3questionschoices(8, 2) = "Asia"
gr3questionschoices(8, 3) = "Africa"
gr3questionschoices(8, 4) = "South America"
gr3questionschoices(9, 0) = "Math: What is the lowest prime number?"
gr3questionschoices(9, 1) = "0"
gr3questionschoices(9, 2) = "2"
gr3questionschoices(9, 3) = "1"
gr3questionschoices(9, 4) = "4"


For questions = 0 To 9
gr4questionschoices(questions, 0) = CInt(Rnd() * 9)
Label1.Text = gr4questionschoices(questions, 0)
RadioButton1.Text = gr3questionschoices(questions, 1)
RadioButton2.Text = gr3questionschoices(questions, 2)
RadioButton3.Text = gr3questionschoices(questions, 3)
RadioButton4.Text = gr3questionschoices(questions, 4)

We cant seem to figure out how to put the questions in a label. The questions are (0,0), (1,0) and so on. The rest are the choices. The choices also has to come in a radio button and the questions should also be randomized.
Were very new at this so its very hard to figure it out so please help
This code is confusing. You have an array of group3questions but you are trying to randomize group4questions and assigning group3questions to it. HUH?
Reply With Quote
  #6  
Old 05-21-2012, 11:29 AM
Gruff's Avatar
GruffVb helppp :( Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

HDC: I do not think he realizes he is setting an array element to be the random number.

Bubblegum2:

You want to pull array element values out of the array.

Get the random number first then
use it to point to a specific area of your Q&A Group.

You do not need to use a "For ... Next" Loop
As long as your array is filled consistently.
Code:
Randomize '... '... Dim nPointer as integer = Cint(Rnd * 9) nPointer = nPointer * 5 'Each block of Q&A is 5 elments 'Notice how the left side of the equal statement is the item being set. LabelQuestion.text = gr3questionschoices(nPointer, 0) RadioA1.text = gr3questionschoices(nPointer, 1) RadioA2.text = gr3questionschoices(nPointer, 2) RadioA3.text = gr3questionschoices(nPointer, 3) RadioA4.text = gr3questionschoices(nPointer, 4)

If you are using VB.NET 2008 then I would use the Random Class
instead of the VB6 Rnd function.

BTW none of this allows your program to verify that the correct answer we selected. See my previous post as to requrements.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Vb helppp :(
Vb helppp :(
Vb helppp :( Vb helppp :(
Vb helppp :(
Vb helppp :(
Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :( Vb helppp :(
Vb helppp :(
Vb helppp :(
 
Vb helppp :(
Vb helppp :(
 
-->