hi,

I was wondering if anyone could point me in the right direction here!!

I have a program that reads in lottery results from the past 6 months (from the national lottery site) from a text file

31-Mar-2010,29,18,38,44,14,43,13,3,GUINEVERE
27-Mar-2010,32,38,11,15,42,6,24,2,GUINEVERE
24-Mar-2010,3,49,28,5,23,42,41,4,GUINEVERE

and stores it in an array (n-1,6) where n is the number of lottery lines, so the array looks like
0 1 2 3 4 5 6
0 29 18 38 44 14 43 13
1 32 38 11 15 42 6 24

then, in a 1D array I store the player's numbers, simply as

0 23
1 16
2 19
3 30
4 45
5 20

I want it to take each number from the player's number array individually and compare them to each row individually in the lotto results array i.e. the first six cells in each row in the results array will be compared with each user number to find any matches, if a value matches then a count is incremented. if the count is greater than 2

but i'm getting no where with it :( i've been trying to use the For To loops but keep getting index out of range, or else nothing is happening at all!!

i don't want or expect anyone to do any of the coding for me - just a few pointers on how to go about it would be great!

Use For Each statement to traverse One/Two-dim arrays.

Dim twoD(,) As Integer = {{11, 22, 3, 2, 3, 1}, {22, 33, 44, 2, 3, 1}, {3, 4, 5, 66, 7, 3}}
        Dim oneD() As Integer = {3, 33, 1, 2}

        For Each playerNo As Integer In oneD
            For Each result As Integer In twoD
                If playerNo = result Then
                       'your statement
                End If
            Next
        Next

Use For Each statement to traverse One/Two-dim arrays.

Dim twoD(,) As Integer = {{11, 22, 3, 2, 3, 1}, {22, 33, 44, 2, 3, 1}, {3, 4, 5, 66, 7, 3}}
        Dim oneD() As Integer = {3, 33, 1, 2}

        For Each playerNo As Integer In oneD
            For Each result As Integer In twoD
                If playerNo = result Then
                       'your statement
                End If
            Next
        Next

Hi,

Just had a look at it quickly there now, I had been using For.. To Loops, gonna give this a try when I get a chance and hopefully make some progress, thanks again!

Just tried it, it works but it seems to be comparing each player number to every result in the numbers array; I need it to compare to each row in the numbers array one by one, like

for each player number
for each row in numbers
for each number in current row
if player number = number
matches = matches + 1
next number
next row
next player number

the thing i seem to be having trouble with is getting it to search left to right in the array for the current row... if anyone can understand what I'm talking about!!

Think I've got it working the way I need it too now, thanks again for the pointers!! :)

You're welcome
I'm glad you got it working. Please mark this thread as solved if you have found an answer to your question and good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.