Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:36:52+00:00 2026-06-15T09:36:52+00:00

I have a custom class called game. Say I create 3 instances of this

  • 0

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”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:36:54+00:00Added an answer on June 15, 2026 at 9:36 am

    You can do something like this:

    Public Class FrmMain
        Dim games as new List(of game)
    
        Public Sub addGames()
            games.Add(New Game With {.Name = "Zelda"})
            games.Add(New Game With {.Name = "Mario"})
            games.Add(New Game With {.Name = "Donkey Kong"})
        End Sub
    
        Public Sub findMario()
            Dim result = (From game In games
                         Where game.Name.Equals("Mario")
                         Select game).FirstOrDefault
    
            'Do something with the result
        End Sub
    End Class
    

    If you need to retrieve the game names from an external text file you could do something like this:

    Public Sub addGames()
        Dim names = File.ReadAllLines("C:\games.txt")        
    
        names.ToList().ForEach(Sub(x) games.Add(New Game With {.Name = x}))
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom class called card and I need to create a set
I have a ComboBox filled with a custom Class called TableHeader, this class contains
I have an array that contains a custom class of mine called 'Game'. Each
I have a custom class that acts as an int called Integer, I would
I have created a custom class called RCTextField , whose purpose is to create
I have a data object -- a custom class called Notification -- that exposes
I have a custom class and std::vector filled with objects of this class. And
I have a custom class that uses boost mutexes and locks like this (only
I have a custom class say 'MyCanvas' derived from wpf Canvas class. MyCanvas has
I have a custom class called Rows that implements IEnumerable<Row> . I often use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.