Link to home
Start Free TrialLog in
Avatar of Member_2_5230414
Member_2_5230414

asked on

VB.net arrays

Hi,

 im currently strongting the output of my loop in a string but have been told it would be better to store it in an array

 Public Shared Function Getthestats(ByVal thedataview As DataView, ByVal hometeam As String, ByVal awayteam As String) As String
        '' dataview-> dtRecords2
        'need to loop through the results in datview and get all results for it 
        Dim hometeamscoresingle As String = ""
        For Each dv2 As DataRowView In thedataview
            If dv2.Row.Item("HomeTeam") = hometeam Then
                hometeamscoresingle += dv2.Row.Item("FTHG") & "|"
            ElseIf dv2.Row.Item("AwayTeam") = hometeam Then
                hometeamscoresingle += dv2.Row.Item("FTAG") & "|"
            End If

        Next

        Return hometeamscoresingle
    End Function

Open in new window



How would i store the above as an array?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry codecruiser.. you typed it out faster than I did :(
It really depends on what you need to do with the data later on....
Just an aside.
Based on this and your other questions I have a horrible suspicion you do not understand databases and how to design tables and relations (or just collections of data in memory).
There are numerous things which you seem to be attempting to do (and have problems with) which ought to be really trivial if the storage of the data was well designed.
Avatar of Member_2_5230414
Member_2_5230414

ASKER

Without shooting me down to much to retrieve the list would be

Dim scoretest As ArrayList = Getthestats(dtRecords2, dv2.Row.Item("hometeam").Trim(), "")

Open in new window

Did it 50/50 :)

Figured out my last question also.