Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (19 June 2013 - 02:28 PM) Long Life To Asta New Era
@  agyat : (19 June 2013 - 01:58 PM) New Era Start At Asta Or Asta Start In New Era. :unsure:
@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?

Replying to Visual Basic: Random Strings!


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

Posted 18 October 2011 - 11:24 AM

Random ElementsVisual Basic: Random Strings!

Hello there..I want to generate random elements of a string that is in a string array.I.E.. Elements of newyork fromDim cities() As String = {"delhi", "pune", "goa","newyork"}Should be displayed at random..Followed by other string array elements..Please help me out..:)

-reply by Hemanth


Posted 02 October 2011 - 02:21 PM

I'm currently in need of a program for my project...We're to interface a circuit via VB... We know what we want to happen on our program yet we don't know how to encode it already in VB... This is how the program goes...FOR EXAMPLE.. There are THREE set of numbers... And inside those sets were numbers stored...SET I = 1-10SET II = 11-20SET II = 21-30(the numbers inside the sets are just examples... We'll be using Input Values from a Parallel Port/Printer Port... -thinking that using other numbers would affect the changes in the program... But I don't really think so... Anyways...)Upon loading the form... The program will randomly choose one of those sets... After that... The user will input the values inside the chosen set respectively and correctly... I.E... The program randomly got SET II...In a label box... The values 21-30 should show in it respectively( the values are inputted to the label box through text box and a command button)... If it goes wrong... It will automatically terminate the program... Otherwise... A message/event will happen that the values are properly and correctly inputted... I hope you get what I'm actually saying...

-reply by Jerome


Posted 02 October 2011 - 01:41 PM

I'm currently in need of a program for my project...We're to interface a circuit via VB... We know what we want to happen on our program yet we don't know how to encode it already in VB... This is how the program goes...FOR EXAMPLE.. There are THREE set of numbers... And inside those sets were numbers stored...SET I = 1-10SET II = 11-20SET II = 21-30(the numbers inside the sets are just examples... We'll be using Input Values from a Parallel Port/Printer Port... -thinking that using other numbers would affect the changes in the program... But I don't really think so... Anyways...)Upon loading the form... The program will randomly choose one of those sets... After that... The user will input the values inside the chosen set respectively and correctly... I.E... The program randomly got SET II...In a label box... The values 21-30 should show in it respectively( the values are inputted to the label box through text box and a command button)... If it goes wrong... It will automatically terminate the program... Otherwise... A message/event will happen that the values are properly and correctly inputted... I hope you get what I'm actually saying...-reply by jerome

Posted 19 November 2009 - 04:29 AM

Listbox with random string Visual Basic: Random Strings!I'm trying to create a program that is a contest. Where you enter names in a input box and they are stored in the listbox. After the names are stored, you click a button and it picks a name at random from the listbox and displays the winner's name in a label. Any ideas?-question by Sherri

Posted 10 December 2008 - 10:14 PM

i want to use this concept but as something differentVisual Basic: Random Strings!

okay I want to make it when you enter a name into a text box it displays that name but after that it displays one of to random phrases such as for example if they put in cody it would return cody and then randomly choose between "is cool"or "some thing else"

-reply by nick

Posted 20 April 2008 - 10:09 AM

help with selecting random pictures
Visual Basic: Random Strings!

Please could someone help with the following question

I'm new to VB and need help, My problem is that I need to know how I can write the correct code which enables a button when each time it is pressed, it randomly selects a picture from 6 different pictures and show this on the screen. The pictures are bmp and would be stored on the pc - I have for now put them in c:pictures location with the file names 1.Bmp 2.Bmp etc...

I am unsure how to write the correct code to select the pictures at random from the file.


-question by steve

Posted 15 April 2008 - 04:01 AM

[Replying to turbopowerdmaxsteel,5264,119 669] I tried to use the code you wrote but I get an error on the word New after the Sub New. I have tried several corrections but can't figure it out. What I really want is a way to have a list of 12 or 16 names that can be randomly sorted for a game, so that partners will be different each month. I wrote one in Quick Basic and it worked great but programs written in QB can't be printed through Windows. I would really like to find a way to make one in vb2005Express.

-question by JRichards

Posted 14 March 2008 - 07:43 AM

random function using in automatically selected question in vb 6.o version
Visual Basic: Random Strings!

Replying to Feedbacker you have a query of question and this query is selected by using random function.

-question by santu

turbopowerdmaxsteel

Posted 27 February 2008 - 09:45 PM

You need to generate non-repeating Random numbers. I made a class for the same which can generate non-repeating Random numbers within a specified range or select a non-repeating Random number from a supplied list of numbers. The numbers will be repeated after a complete cycle finishes and all the numbers have been generated once.

You can find the VB.NET code at http://maxotek.net/blog/?p=9

You could modify the code a bit to directly select one of your words stored as string types.

Public Class RandomNumber
	Dim WordDomain As New ArrayList	  ' The Words to be generated
	Dim Words As New ArrayList		   ' The Words waiting to be generated
 
	Sub New(ByVal ParamArray Words() As String)
		' Words in a Param Array
		Dim Word As String
		For Each Word In Words
			WordDomain.Add(Word)
		Next
 
		AddItems()
	End Sub

	Sub New(ByVal Words() As String)
		' Words in a String Array
		Dim Word As String
		For Each Word In Words
			WordDomain.Add(Word)
		Next
 
		AddItems()
	End Sub
 
	Private Sub AddItems()
 
		Words.Clear()
		' Insert All Words Into the Array
		Dim I As Integer
		For I = 0 To WordDomain.Count - 1
			Words.Add(WordDomain(I))
		Next
	End Sub
 
	Public Function GetRandomWord() As String
		If Words.Count = 0 Then
			' Re-add the Items, when all the words have been generated.
			AddItems()
		End If
 
		' Return a Random Item and Remove it from the List
		Dim Ch As Integer
 
		' Using Timer as the seed for the Random Number Generation
		Randomize(Microsoft.VisualBasic.Timer)
 
		' Random Number is generated within the range.
		Ch = 0 + CInt(Rnd() * (Words.Count - 1))
 
		Dim Word As String = Words(Ch)
		Words.RemoveAt(Ch)
		Return Word
	End Function
End Class

The above code generates Random words based on a supplied list using a String array or as a ParamArray.

Posted 26 February 2008 - 06:11 PM

Word (Integer)
Visual Basic: Random Strings!

I am currently trying to make a spelling program in which it has 3 levels .
What I'm stuck at is when it comes to coding it how do I get it so words are shown on a label then took off in which you can then right in the text box what word it was. How do I then have random words come up but not have them show again so that the person isnt seeing the same word over and over again.

-question by Paul

Review the complete topic (launches new window)