943,923 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 474
  • VB.NET RSS
Jan 22nd, 2009
0

Arrays help?

Expand Post »
i am using vb dot net 2003.

I want to store randomly generated numbers in an array. The Numbers are declared as integers. The amount of numbers generated will not be constants so i can not initialize the array before hand. However the numbers generated will be from 1 to 5000.

After the randomly generated numbers are generated i will ask the user to input a "number" , then i will check using a loop if the number stored in the above mentioned array (the one which holds the randomly generated numbers) matches the value input. i know i have to use a loop. But do notknow how this would be done.
i can not figure out how to do this please help. thank you.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asif786 is offline Offline
19 posts
since Dec 2008
Jan 22nd, 2009
0

Re: Arrays help?

Look my friend I don't know how you don't know the size of array and you said you will generate some number, so tell me when you'll stop generating numbers? Any way I know you question is away from this.
Your question answer is
vb.net Syntax (Toggle Plain Text)
  1. For index As Integer = 1 To YourArray.Length
  2. 'Your search algorithm resides here
  3. Next
It'd work whatever you know the size or not and if you changed its size at runtime.
Hope I got more from you best of luck
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 22nd, 2009
0

Re: Arrays help?

Look my friend I don't know how you don't know the size of array and you said you will generate some number, so tell me when you'll stop generating numbers? Any way I know you question is away from this.
Your question answer is
vb.net Syntax (Toggle Plain Text)
  1. For index As Integer = 1 To YourArray.Length
  2. 'Your search algorithm resides here
  3. Next
It'd work whatever you know the size or not and if you changed its size at runtime.
Hope I got more from you best of luck
but how would i store the generated numbers in an array. lets say number is stored in variable called numbers and is declared as an integer. how would i get it to store randomly generated numbers into array as they are generated.

please help thanks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
asif786 is offline Offline
19 posts
since Dec 2008
Jan 23rd, 2009
0

Re: Arrays help?

OK, show me to where you reached, post some code to know how can I do the next step.
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: vb.net and compact framework?
Next Thread in VB.NET Forum Timeline: Visual Basic- need to make a field mandatory w/out a dropdown box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC