Using 2 Arrays To Make Random States Capital Quiz?
Nov 29, 2011
I have to make a program that uses 2 arrays, one with the states name and one with the capitals names. I have to make it to where it randomly selects a state and asks you what the capital is, and gives you 4 choices in the 4 radio buttons provided. My problem is getting one of the randomly selected answer choices to be the Correct answer.
Here is my code so far:
Public Class USCapitals
' Declare module level variables.
[Code] .....
View 3 Replies
ADVERTISEMENT
Mar 4, 2011
trying to make a Multiple Choice quiz, with 20 questions
-4 RadioButtons
-2 Label (Reading the Questions) and 1, keeping a score count
Do I wanna make some arrays like Questions(20) and Answers(20)
Dim ScoreCount as Integer
So I want it to be a little screen, and once you click a Radiobutton to choose answer, it will change the label to Question(2) so forth.. but I am unsure how to do this. I am fairly new to vb, im doing this to learn.How do I make it so everytime you click a radiobutton wether it's right or wrong, the next question and possible answers all change??
View 1 Replies
Oct 30, 2010
the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "
Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"
[code]....
View 1 Replies
Aug 28, 2010
I want to do is have textbox1.text show 10-20 characters that are random letters and numbers when i press button1. I have tried to do this but I am not so great with generating anything that is random. If possible have it be a mix of Capital and Lowercase letters.
View 1 Replies
Jan 2, 2011
I want to do something along the lines of
txtCapital.Text = "Berlin" Or "Lisbon" Or "London" Or "Madrid"
but Visual Basic.Net says this is an invalid cast exception.Is there another way to create a random selection of for example a capital city from a list and then put into a text box?
View 8 Replies
Mar 6, 2010
I use for example:
Dim S As String = TextBox1.Text
if(S.Contains("BlaBla") Then
' ..
End If
But when I use blabla in my textbox it doesn't work..How Can I ignore the capital letter or non-capital letter function?
View 6 Replies
Jan 29, 2012
How to create a Random quiz? I use groupboxes for every questions that i have because it has 10 items per quiz then i have 10 groupboxes. Another problem is, i was planning to create a .swf file in my visual studio project actually a button to make it more fascinating to use but it is possible to have a .swf file on my project and every time i click the button on ".swf" file the visual studio form will appear.
View 5 Replies
Mar 31, 2011
I make a 2 questions and then 4 choices for each question..and the 4 choices is made up with radiobutton.. and 1 of the 4 choices is only the right answer..Computing of right answer in each question is the thing that I want to know, how to do..
View 1 Replies
Mar 11, 2011
I want to make a quiz that generates score and save in access 2007.
View 4 Replies
Mar 31, 2009
The Quiz is timed. Its result is in "m:s" format. How to make this result permanent, i.e. when the game is restarted the results would still be there?[cod]e...
View 5 Replies
Apr 2, 2009
Make a Quiz result sortable? Option Strict On[code]...
View 2 Replies
Feb 27, 2012
I am learning VB at the moment and i'm planning how i'm going to make a simple quiz style web application. I want to have a series of questions, one per panel, that a user can select from multiple choice and proceed to next question with at least one option needing to be selected before going to the next question. At the end users get their score out of X.
Forgetting the validation and other bits i need. My thinking is to use a series of panels that have my questions in, so one panel per question, and by default they are all set no invisible bar the first question. Then as the user selects the question the next panel is revealed and the previous hidden, and so on etc.
View 1 Replies
Jan 22, 2011
I have to make a multiple choice and true or false quiz in VB. So i am thinking of two questions on one form.BUt i have to make the questions appear in random and not in order and make sure they dont repeat.Btw, i have searched a long time for this. I have found out how to make random numbers. But I have to make sure only 10 come and not repeated.
View 11 Replies
Oct 13, 2009
Im trying to make a simple quiz in visual basic all it has is a label a textbox and two buttons. one of the buttons if for checking if the answer is rite while the other is to go to the next question. i want to make it so when the next question button is clicked the label changes to the next question and the textbox is cleared and then when i press check it checks the answer.
View 6 Replies
Jun 29, 2012
I have an assignment that requires me to create 5 different arrays: nouns, adjectives, verbs, prepositions, and articles. From those 5 different arrays, it has to display 10 different random sentences in the listbox named lstRandomSentences. The sentences have to be in the following order:
<article> space <adjective> space <noun> space <verb> space <preposition> space <article> space <adjective> space <noun>. Each of those arrays have to be randomly chosen in the list box and that's what I am having trouble outputting randomly.
View 10 Replies
Nov 17, 2011
Been trying to think out something for this one but i can't come up anything. Arrays is kinda tough for me.
I am trying to practice a program that:
1. ask the user for number of elements
2. Use IsNumeric Function to catch an error.
3. A 3rd form pops up showing random numbers like this:
0 45
1 23
2 56
3 75
4 34
5 99
Then, after i click a button called "Sort" It sorts the random numbers from lowest to the highest value.
Public Class Form1
Private Sub btnGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerate.Click
[Code].....
View 14 Replies
Apr 26, 2011
I'm working on a program that calculates 2 things. First I need to fill a 5 x 5 array with random #'s from 1 - 10 and Determine the average of each row, each column and the two diagonals, and the second calculation is Fill a 100 element array with random numbers from 1 - 100 and determine the standard deviation and mean of the random numbers in the array.
View 7 Replies
May 29, 2011
I am trying to make a texas hold em game and it is of the utmost importance that my code generate a random number. But using a random number function that I always end up with a lot of the same numbers over and over again. Any ideas on how to make it "TRULY" random? [code]
View 3 Replies
Feb 24, 2010
In the player vs computer tic tac toe game I've been working on there are 2 boolean arrays (one for the computer and one for the player) that track which cells have been taken. When all other moves have been exhausted I would like the computer to play a random cell. To do this I am trying to gather the indexes of all False values from the 2 arrays and add them to another dynamic integer array. The computer will then choose randomly from the new array. The two Boolean arrays are plyrTaken and cmptrTaken. The dynamic array is occupied.
Here I declared the arrays:
Public Class Form1
Private occupied() As Integer
Private plyrTaken(8) As Boolean
Private plyrPairs(14) As Boolean
Here I got the dynamic array ready for use:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
ReDim occupied(0)
And here is the code I have attempted:
For index As Integer = 0 To 8
If plyrTaken(index) = False And cmptrTaken(index) = False Then
ReDim Preserve occupied(UBound(occupied) + 1)
[Code] .....
In the last block of code I was just trying to print the contents of the array to a list box so I could see if it was working. Obviously, it's not. When one position is occupied the list box shows the occupied cell index with a Zero. This really shouldn't be there as I want only taken cell indexes to be sent to array and list box. When a second position is occupied 7 zeros are added to the list box. Kinda shows promise as 9 total cells - 2 is 7 but there should be index numbers other than zero to represent the cells that have been occupied.
Also, the indexes shouldn't keep adding on to the dynamic array I need a way to clear the array and resize it back to 0. I tried adding
Redim occupied(0)
to the top of the code but that didn't seem to work.
View 17 Replies
Nov 14, 2010
I'm trying to create a program that produces random sentences as output. With five arrays of strings, one each for nouns, adjectives, verbs, prepositions, and articles. Each array should hold several words for that part of speech. Like, the Articles array could hold the strings "the" and "a"; the Nouns array could hold "Martian", "baby", "skunk","computer" and "mosquito"; the Prepositions array could hold "around", "through", "under", "over", and "by"; and so on.
It's supposed to generate sentences by randomly choosing eight words (randomly generating eight array indices) from these arrays, always constructing sentences by using the parts of speech in the following order: article, adjective, noun, verb, preposition, article, adjective, noun. Also, the code should be properly modularized so that the code to generate each part of speech is not repeated.
View 3 Replies
Jul 27, 2011
I have learnt how to create a basic random word generator. I now want to take this further but I would like to know if what I am thinking of is possible. I am in the process of wanting to create a random name/word generator which reads/loads an array from a text file. think this part I will be Ok with as there are some vids and tutorials about. However, I wish for the text file to have multiple arrays and then dependant on the day and time of the day, only a string from the current time array is loaded. Does that make sense and is it possible? I am happy to spend time learning how to do this but only if it is possible.
View 3 Replies
Nov 3, 2010
So as the name states; I am a newer coder.
This is the code i have:
Public Sub RandomNumbers()
Dim s(4) As String
Dim RandomNumber As Byte
I don't know if you can tell what I am trying to do here, so I will try to explain. I what to create for random numbers and place them into for different text boxes. I also would like to do this with combo boxes and their selected indexes. So if the combo box has 10 items in it; the new selected index would be the random number generated above.
View 5 Replies
Nov 19, 2011
Dim Paper As Graphics
Paper = picBox.CreateGraphics()
Paper.Clear(Color.White)
[code].....
View 12 Replies
Oct 29, 2010
how to make an array of buttons in vb .net 2005. It seems very different in vb6 'coz in vb6 you have just to add an index on its property but in vb.net there is no index property. Can it be made by designing in on the form just like copying and pasting on the form in vb6?
View 2 Replies
Apr 28, 2012
How can I make a highscore page with 2 arrays that store a name and a score. I want my highscore page to have thier name and score but also only have 10 high scores with highest to lowest. Also it must save so anyone that plays will see it.
View 3 Replies
May 18, 2010
This probably sounds daft, but im struggling to get to grips with Classes/Modules/arrays and objects, as well as there uses and what they are, and yes im still coding some how i hear you cry.The reason i ask is because Ive got a load of Dim's in my program that are the same giving locations of files and folders and wondered can they be used as a module that i can alter after the program is built, incase of folder locations being wrong or moved, manually correct after install.
View 1 Replies
May 1, 2012
im trying to make picture boxes as arraybox(0)box(1)ecti want it to be an array so i can make infinite of them
View 15 Replies
Dec 11, 2011
I was asked by a client to create a tool that would let a user add/modify/delete/read content from a database. The content can be read from TextBoxes.
My question is, what is the best way to manage GUI locks/unlocks for the different states of the program. IE: If I'm in a "insert" mode, some GUI elements should be enabled, and some not. If I'm in the "read-only" mode, a bunch of them should be disabled... etc.
View 1 Replies
Mar 1, 2011
In many projects I work on, whenever I have to return a read only collection, I use the IEnumerable<T> interface and make it type specific like so:
CODE:
Most of the time, I return a List but in some functions and read only properties I return an array which also serves the purpose alright by kind courtesy of Extension Methods.
My question is am I violating any design principles by returning IEnumerable<T>s instead of specific types (e.g.: List<T>, HashSet<T>, Stack<T> or Arrays)?
View 8 Replies
Mar 31, 2009
Like maybe some of you when I'm chatting I like to put a capital letter at each word. (Ex : Hello My Name Is -Achi-)I can type fast but I hate continuously pressing Caps Lock button so that's why I thought about a program how would do the job for me ! xP
[Code]...
View 4 Replies