473,385 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Search Numbers

in this program i have to generate 10 random numbers and then search
them for any matches.
this was an old program i wrote and dug it out but i must have screwed
around with it before and stupidly saved it and now it doesnt work...

i used 2 for loops but decided to just put them together.

it keeps saying its found 3 matches (but it hasnt) and displaying the
first 3 numbers generated
any help would be greatfull thanks
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim index, index2, rnd2, match As Integer
Dim list(9) As Integer

match = 0
TextBox1.Clear()
textbox2.clear()
Randomize()

For index = 0 To 9
rnd2 = CInt(Int((10 * Rnd()) + 1))
list(index) = rnd2
TextBox1.Text = TextBox1.Text & list(index) & vbCrLf

For index2 = index To 2
If list(index2) = list(index) Then
TextBox2.Text = TextBox2.Text & list(index) &
vbCrLf
match = match + 1
End If
Next
Next
MessageBox.Show("there were " & match & "matches", "data out",
MessageBoxButtons.OK)
End Sub
End Class

Nov 21 '05 #1
0 791

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Cengiz Ulku | last post by:
Hi, I know now, how to search for a special char. or a word in a RTB control. But, my question is: My RTF file is some sort of an index document, there are chapter numbers and within these...
2
by: William Morris | last post by:
Apologies in advance for the cross-post. Not sure if this is better handled in ASP code or TransactSQL. Windows2000 Server SQL 2000 tblPeople contactid int firstname varchar(25) lastname...
1
by: disaia | last post by:
2 problems: Example: If a person types in a part number into Yahoo: 1. Is there a way for Yahoo to list your web site as one of the results. 2. If the user clicks on your link, can your web...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
1
by: kali06 | last post by:
Hiya, thanks for reading this. just to make it a bit simpler. i am just starting out and what i have to do is search a csv (which has account numbers in it). then search the sql databse for the...
5
by: mike | last post by:
SQL 2000. I need a query that will search a field in the table that is 14 characters long and begins with a number. I have a client that was allowing people to store credit card numbers,...
5
by: Terry Olsen | last post by:
To comply with corporate policy banning the storage of social security numbers on computers, I have been asked if I can search for files & emails that contain social security numbers. I thought...
3
by: alexmason86 | last post by:
getting a bit stuck here got some code that allows a user to input numbers to a 3x3 array. but next on the tutorial sheet i have to then ask the user for a number to search for and then search the...
3
by: mercuryshipzz | last post by:
#!/usr/bin/perl #use strict; use warnings; sub search_pattern { my $file_name = $_;
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.