Generating Random Questions In A Vb2008
Sep 5, 2009
Iam doing a project in vb2008 for a quiz program. i want to randomly generate questions in a textbox a question should occur once in the quiz session. i had my code:
Imports System.Data
Imports System.Data.OleDb
Imports AgentObjects
[CODE]...
View 1 Replies
ADVERTISEMENT
Jan 4, 2010
Why does it give exactly the same numbers despite different variables? See below code:Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyRand1, MyRand2, Myrand3 As New Random
[code].....
View 1 Replies
Mar 3, 2012
how can I retrieve random data(questions) from access 2007 using vb 2008?
View 4 Replies
Nov 26, 2011
VS2010 (SP1) / .NET 4 on Windows XP. The question is simple, the answer; not so much. When generating a salt, should the LENGTH of the salt be random, fixed or a random number within a (min/max) range? I am using RNGCryptoServiceProvider to generate the salt, just unsure of the length of the salt.
View 12 Replies
Mar 9, 2009
I'm wondering how I would go about generating a random number in VB.Net. As I am developing an ATM system for a bank, a randomly generated 4 digit PIN code would have to be assigned to each person.
View 2 Replies
Jun 4, 2012
i am working with Visual Basic 2008 and i wanted to know how u can create a random word?
View 8 Replies
Mar 14, 2012
i have a few questions about generating random numbers:1) is it possible for the programme to generate a random number that it has previously generated (i.e could it produce the same number more than once?)2) can you specify what numbers to generate? e.g only whole numbers up to 1000?
View 4 Replies
Mar 1, 2012
I have to generate a series of random numbers, say 100, within range of -1 and 1 and scale them by a value, say square root of 2. After which I take those 100 values and their sum = 0. Then scale that sum by another value. Check the code below to see what I mean.
[Code]...
View 1 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
Mar 19, 2010
I am trying to make a number be generated as this Windows Form loads, then the user guesses by entering a number and clicking a button to check whether it is correct or incorrect.
I have the code complete, I'm just confused on how to declare the random variable outside the button sub procedure so it only generates one time.
Here is my code.[code...]
View 6 Replies
Apr 7, 2009
I'm using VB.NET 2008 Express Edition and I'm trying to create a simple program that will roll a number of dice I choose. It does this by generating a random number within a specified range (I'm rolling 3-sided dice in this case so I'm generating numbers between 1 and 3) and adding each number to a textbox to create a total of all the dice rolled so far.
This is my
Private Sub butRoll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRoll.Click
Dim RandNum, i As Integer
Dim RandomClass As New Random()
'if at least one dice is rolled
If txtD3.Text > 0 Then
[Code] ......
Now the problem I am having is that although my random number generator is generating the right numbers (confirmed by checking the txtLastRoll textbox), when I add it to txtTotal, it seems to be getting another number from somewhere and adding that to my random number then adding it to the total and I have no idea how this is possible! txtTotal always starts as 0 but txt1 is not showing that. Normally I would just set txtTotal to 0 there but if I do that, I won't be able to add the numbers together. I've tried finding a pattern in the mystery numbers appearing in txtTotal but they just seem to be random.
View 7 Replies
Feb 6, 2011
I am working on an application, where I have already normalized the databases. Now I am creating an application in asp.net with vb.net as my code behind fine. These random numbers would be stored in the Id column. So, no way there would be repeating the keys. But my application could generate the key, which would probably get repeated. How would I check the database for, so that random numbers wont get repeated? is there any function? Could you give me the code for the same.
View 10 Replies
Nov 24, 2011
How would I go about doing this, is there a for next loop involved and is there a way not using the for next loop ?
View 15 Replies
Jul 16, 2011
How do I go about generating a random vector coordinate that is within say 200 units of another vector coordinate?
View 2 Replies
Feb 20, 2009
is there a code for generating random letters and numbers?? like between 0 to 9 and A to F??
I used this code :
[Code]...
View 5 Replies
Jul 15, 2010
I want to generate random number, which is 9 digits including leading zero if the number is less than 9 digits, say 123 will be 000000123. I have the following code which doesn't include leading zero :
Dim RandomClass As New Random()
Dim RandomNumber = RandomClass.Next(1, 999999999)
View 3 Replies
Feb 25, 2011
I'm trying to use a GUID to generate 6 random alphanumeric characters (just letters and number). Is there a way to change the format of a GUID before it is generated. Or must I generate the GUID in its standard format and then manipulate it.
View 5 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
Aug 22, 2009
Dim strFilename As String strFilename = Format(Now, "ddmmyyyyhhmmss"
That generates the day number month and so on. But i want to generate a string with "VB Code Snippet" then after that just any 5 letters or numbers so it might generate "VB Code Snippet 7ef82"
View 17 Replies
Dec 24, 2009
I am using Visual Basics 2008 Express edition. I want my program that I am making to generate a random amount of numbers and letters in this form when I click Button1.
WM9RX-GG6J2-4WKD9-FDJWM-TYH76
Is this possible?
View 8 Replies
Aug 4, 2009
Im trying to use the library in GNU in VB2008 to generate random number with uniform distribution (actually will also use it for other distributions)...I already added dll under bin file and try to run the following code, but just cant make it work:
Public Class Form1
Declare Function gsl_rng_uniform Lib "C:vbuniformuniforminDebuglibgsl.dll" (ByVal x As Double, ByVal y As Double) As Double
[code].....
View 1 Replies
Apr 28, 2007
I'm converting a user generated list box to an array and then generating a user defined number of random strings and placing it in a textbox.The code I have works fine as it will generate the number of random strings the user wants, except sometimes a line is blank at the top of the list but is counted as a string.
View 4 Replies
Sep 17, 2011
I have this program generating a firstname and lastname from a file. When I run this program I enter information in three textboxes. The first two are the salary low and high(salary1.text, salary2.text) and the last one is the number of "copies"(copies.text) that I want.. When I put a number such as 10 in the text box it outputs some of the same names. The firstname file has around 100 records and the lastname file has about 1000 records Why is it generating the same name The problem is even worse if I do something like 1000 copies.. it outputs the same thing 8 times and then does something different another 8 times
Public Class Form1
Dim sex As String
Function randomfirstname()
Dim infile As IO.StreamReader
[code]....
View 1 Replies
Jun 7, 2006
I heard that you have to add some code to a random number generator
results(1) = Int((5 - 1 + 1) * Rnd() + 1)
so that if it is used again and again it keeps generating new numbers as apposed to what this piece of code does by itself which is creates the same number every time.what is the code?
View 10 Replies
Apr 2, 2012
im stuck programming a visual basic quiz.I cannot get my questions to appear on the buttons on visual basic 2008 and do not not why not.
[code]...
View 15 Replies
May 6, 2011
I have made a screensaver in VB.NET. I am running into some roadblocks in the code though. The idea first was to have a ball bounce across my screens. It then evolved into spawning new balls that bounce across the screen. I then added collision detection so they would bounce off each other. Here is the problem that came up:
When said balls overlap each other, you can easily distinguish the edges of the picturebox that holds the images. I have made the background of the picturebox transparent, made the bitmap with a magenta background and made magenta transparent (for the image), but I can still see the picturebox edges when they overlap. It seems the transparency is not only making the background transparent, but giving it X-RAY vision to display not the visible area behind it, but the root background color of the form. here is a sample of the code which makes the transparencies.
Private Sub frmscr_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim bmp As Bitmap = My.Resources._smiley_face_image
Dim clr As Color = Color.FromArgb(255, 0, 128)
bmp.MakeTransparent(clr)
[code].....
I also tried to see if changing the image from background to foreground would help...no such luck.
View 4 Replies
Jul 28, 2010
I am making a game on vb.net. It is like a quiz game. In the game there is a button which when pressed pops up a question. The code for the input box is as follows:
Dim Answer As String = ("sodium chloride")
Dim Question = InputBox("You have mixed Sodium and Chloride. What is the ionic bond name of this?", "Question?")
[code]......
View 4 Replies
Mar 19, 2009
I'm trying to make a quiz application with Visual Basic at the moment. I want to write a routine that asks five questions to which the answer must be either Yes or No. It must add up the number of Nos and if the number of Ns is less than two then print out "pessimist", otherwise print out "optimist". So far this is the design of what I've done. [URL]. However, I have no code which I've produced on my own.
Code:
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
End Class
I really don't know how I can kind of add up all the results from each individual question, seeing as radio buttons are used.
View 2 Replies
Nov 3, 2011
I am in the process of creating an array for a set of multiple choice questions but I am having a few problems. I am an absolute beginner at VB and I am creating a quiz that users will select one of three possible questions and then depending on their answer a +1 value will be added to the score. However I do not know where my questions and answers are supposed to go, from what I have read online I have to use (0, 1) format to give possible answers but I do not know how I would make the questions and answers display in textboxes on my form. At the bottom of my code I have also included code to randomise the questions although I am unsure as to if it is correct. At the moment I can run my form fine without any problems but my main issue is to how I will get the questions and answers linked to my textboxes on my form.
Public Class frmTest
Private ran As Random = New Random()
Public intScore As Integer
Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
'Turns the message box invisible when start is clicked
lblMessage.Visible = False
[Code] .....
View 5 Replies
May 30, 2012
I need to create a questionnaire with ten questions. The questions can be hard coded as labels. I will have a radio group box for each question, with options, Always, Usually, Sometimes, Seldom and Never. I will then need to store these values for each time that the questionnaire is answered, and another button that will show the question number and the answer count for each question up to that point in time e.g. [Code] I am also assuming I will have a button that when clicked, will identify the active radio button and add 1 to a counter? [Code]
View 13 Replies