title: "Passing" a structure in VB.NET
body: <p>I want to display the information of some games in a list box after opening a file and analysing its contents.
  I have basically finished my project, but I can't seem to quite get it to work. What I want to do is to have the information for each game change whenever the index of the list box of titles changes.
  My problem is that I am trying to use a structure to store an array and some other data in it, but when the next event happens (the index change) the structure becomes empty and I am not sure how I would pass in an (I think its called instance) to my new function or if there is even a better way to do this.
  Here is my code: <a href="http://pastebin.com/i0Ga3fcD" rel="nofollow">http://pastebin.com/i0Ga3fcD</a> 
  Any help would be greatly appreciated, if you need any more info I will try my best to help you in anyway possible.  </p>
  
  <p>My code snippet:  </p>
  
  <pre><code>Sub populateListboxWithInfo(ByRef strValidGames)  
          Dim intCount As Integer = 0  
          Dim intLengthOfArray As Integer = strValidGames.Length  
  
          Do While intCount &lt; intLengthOfArray - 1  
              Dim strArraySplit() As String = strValidGames(intCount).Split(New Char() {","c})  
              lstInformation.Items.Add("Rating: " &amp; strArraySplit(2))  
              lstInformation.Items.Add("Quantity: " &amp; strArraySplit(4))  
              lstInformation.Items.Add("Price (per item): " &amp; strArraySplit(5))  
          Loop  
      End Sub    
  
  Function getValidGames(ByRef gameInfo)  
          Dim intLenghtOfArray As Integer  
          Dim intCount As Integer = 0  
          Dim strArrayValidGames() As String  
          Dim intArrayStore As Integer  
  
          intLenghtOfArray = gameInfo.strGameInfo.Length  
          Do While intCount &lt; intLenghtOfArray - 2  
              Dim strArraySplit() As String =   gameInfo.strGameInfo(intCount).Split(New Char() {","c})  
  
              If strArraySplit(3) = gameInfo.CharType Then  
                  If strArraySplit(1) = gameInfo.strPlatform Then  
                      ReDim Preserve strArrayValidGames(intArrayStore)  
                      strArrayValidGames(intArrayStore) = gameInfo.strGameInfo(intCount)  
                      intArrayStore += 1  
                  End If  
              End If  
              intCount += 1  
          Loop  
  
          Return strArrayValidGames  
      End Function  
  </code></pre>