I have a custom class called “game”. Say I create 3 instances of this class.
Public Class FrmMain
Public Sub addGames()
for x As Integer = 1 To 3 Step 1
Dim game As New game
if x = 1 then game.name = "Zelda"
if x = 2 then game.name = "Mario"
if x = 3 then game.name = "Donkey Kong"
next
End Sub
Public Sub findMario()
'What goes here?
End Sub
End Class
What do I put in my sub “findMario()” to get the instance of “game” the name property equal to “Mario”?
You can do something like this:
If you need to retrieve the game names from an external text file you could do something like this: