Select Random Word?
Feb 13, 2010rying to make a program that will pull a word out from a text file and put it in a textbox
View 2 Repliesrying to make a program that will pull a word out from a text file and put it in a textbox
View 2 Repliesi have to write a simple Hangman game with sum extra features for bonus points.... the funny thing is i can write the code for the extra features such as "adding additional word, help menu...etc",but i cant write the main program,The program must select random word from text files, it have three difficulities, the codes should be the same for all three, just read from different files...(well thats what i think)... i think i hav to use array... but how do i read the contain of the text file into an array n randomly select a word?
[code]...
Say I have a string like this:
"Hi My Name is {Robert|John|Wayne} and I like the color {blue|green|yellow}"
How do I select a random word in {Robert|John|Wayne} and {blue|green|yellow}?
i am working with Visual Basic 2008 and i wanted to know how u can create a random word?
View 8 RepliesOk so i would like to have like a list of lets say 500 words. I would like to randomly select 5 of them. Almost like a random number generator. iam using this software http://tiny.cc/2eufdt2k1k
View 2 RepliesI am making a program to enter random phrases and words into an object on a web browser. I am not sure how to make the program choose a random phrase or word though.Basically I need to have a list of 100 or more words and phrases inside a program, and for the program to choose one when called upon.
View 3 RepliesI want to make a random word generator. Like just the words that I type in the script though. Could anyone please give me the code?
It would just be a simple word that appears in a text box. But in the script it puts one of the random words i tell it to every time you click the button. I know lua 5.1 scripting a little. I'm only 13 though. So as you can imagine I'm no mastermind at code.
button1 function onclick
print word.math;random(word1,word2,word3,etc)
My current task that I am working on is a word generator. I want my program to generate words that I have selected such as mammal, amphibian, arachnid, insect. Random generates or puts one of those words in a text box in my VB program. I can only find code that generates the strings such as a single letter but not words.
View 8 RepliesSo what I'm trying to do is not so much generate a random word but pick one from a collection. I was thinking on generating a random number since that is very easy, then picking a word acording to the number generated. Is there a more efficient way of doing this?
View 9 RepliesI have a form with a tic tac toe game on it. I have been trying to make it have a single player mode by allowing the computer to select one of the 9 buttons. However I can't even get it to select one of the buttons. Is there anyone out there that can help point me in the right direction.
View 3 RepliesI'm new to VB and am trying to create something that will change specific words within a DB entry to a random word from a table. My goal is to change swear words to a random word in a separate table (like darn, dang, waterstopper, etc.) So far I have an "Input" table with the text I need to change and a "SwearRep" table with a list of words I need to replace in col "WBad" and their replacements in "WGood".
View 1 RepliesAs in today i click on the button it will display the item when i hit again the button it will still display the same item and last for the whole. On the second day, i hit the button again it will display other items and last for thewhole day again.
[Code]...
I just want to select 1 random record from my database for example in my table1 i have a,b,c,d,e,f,g then everytime i click the button in my program it will output randomly between a to g then i can add another record from my database and if I make it a to x it will randomly choose between a to x, the random doesnt have any conditions.
Right now i've found some codes that will be very useful but i cant modify it so it will be connected to my database.
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DT1 As New DataTable
DT1.Columns.Add("SN1")
DT1.Columns.Add("NAME1")
[Code]...
I am also very new to visual basic, and need some simple advice from you guys. I basically have a button, text box and a .txt file.When the button is clicked, I need one of the entries in the .txt file (which are names) to be selected and displayed in the text box
View 5 RepliesI'm working on a program that will randomly select a loadout(weapon, perks, etc), but the user enters their current level to get the loadout. This is important because certain guns unlock at certain levels, so i don't want someone getting something they can't use.
I'm not sure what the best way of approaching this is. All i can think of is either getting a random item, checking if the user's level is high enough then if it's not high enough do it again.
I have 25 labels (Label1 - Label25). How can i randomly make the background of 1 label blue?I can set a random number in a variable, but I can't find out what to do next. It has to be something like this:[code]
View 1 RepliesI need to have two pieces of software, made in vb where one encrypts the contents of a .txt file, and the other decrypts it, and then picks one word at random and displays it each time a button is pressed, but never displays the same word. Or, if there was a way to hard code it into the program as there is only 5 words that would be better.
View 1 RepliesI need to pull a random word from a text file in my resource folder (visual Studio 2010) and then have a user enter a letter to see if it is in the word. Yes, Hangman game. There is more, but right now I need to pull from that text file for a start. I know what I have is not even close to right under "Get Word Button", but I'm kind of confused about the process.
Public Class hangMan
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim word As New Random
End Sub
[code]....
I have to use the word list supplied and cannot use "streamreader" so, I need to pull a random word from text file in my resource folder (Visual Studio 2010) so user can guess letters for hangman game). I don't know if the code under "get word" button is right or not as far as pulling from the file. I would like to get that far!
[Code]...
If I have say 5 numbers: 1, 29, 53, 95, 103 What would be the VB.net code for randomly selecting a number of those 5.
i.e) The random number has to be 1, 29, 53, 95, or 103 and has to be randomly generated.
I've tried using the Int(Rnd() * 104), but I do not know how to make it choose only these 5 numbers!
i want to get a random directory from a specified directory, for example, the desktop.
im not sure how to do this, this and the only thing I'm having trouble with for my application
for example i have 5 different directories on the desktop called
Dir1
Dir2
Dir3, etc...
i would like to get Dir3, then maybe Dir1, after that maybe Dir3 again, and so on. i want to get a random directory from the desktop...dont really know how to explain it any better...
A specified a directory - a directory that i specify maybe in a text box for example. or a folder browser dialog
also i just want to get the path of the directory, i dont want to do anything to it.
I want to select a random image from my resource folder and show the image in a picture box.
View 9 RepliesI need to grab just one row, and output its name and details properties to a sidebox on my page.So far I have come up with this, which is not working and giving cast errors between the entity and the list of.
Public Shared Function GetOneRow() As String
Dim db As New Model.Entities
Dim rowCount As Integer = (From t In db.Table Select t).Count
[code]....
I use this connection:
Dim connetionString As String
Dim cnn As SqlConnection
connetionString = "Data Source='" & txtHost.Text & "';Initial Catalog='" & txtDatabase.Text & "';User ID='" & txtUser.Text & "';Password='" & txtSenha.Text & "'"
cnn = New SqlConnection(connetionString)
cnn.Open()
cnn.Close()
How I read to SQL using "SELECT * FROM table ORDER BY rand()", select a random column and send the value "User" and "Password" of this column to Label1 and Label2.
I want to select a random record from a data source (based on an MS Access file), and place the record cell contents into certain textboxes. After the record is chosen, it cannot be selected again.
View 1 RepliesI was trying to at random select a listview item, I tried:
Dim random As New Random
Dim test As String = random.Next(0, formMain.ListViewSearchResults.Items.Count)
MessageBox.Show(test)
but this brings me back a "0".
I've tried to do this
[Code]...
but it wont select. Btw, yes the list is full of strings lol.
I'm trying to have this WebBrowser1.Document.GetElementById("box").SetAttribute("value", Random)" I want to have a random Text from selection like
[Code]...
I have images stored in my resources that I want to call randomly to use as a background for an app. How do I call them randomly
View 1 RepliesI basically have 1x text box and 1x button. I also have a text file set out as follows:
Fred Alston
Samuel Takahashi
Toni Tyree
Tonya Engel
[code]....
Except there are about 60 names.When the button is pressed, I want a name to be selected at random and placed into the text box.