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 8825591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:54:59+00:00 2026-06-14T06:54:59+00:00

Hi I have a little problem with a list of custom objects i wrote.

  • 0

Hi I have a little problem with a list of custom objects i wrote. When I use the list.add(xxx) method it doesn’t simply append the xxx object to my list, but it turns each items to xxx and I don’t know how to fix it.
Here is the declaration of my custom class:

Public Class User

Private Shared n As String
Public Shared Property Name() As String
    Get
        Return n
    End Get
    Set(ByVal value As String)
        n = value
    End Set
End Property
Sub New(ByVal name As String)
    User.Name = name
End Sub


End Class

And here’s where I call the list.add method

Public Class Form1
    Private Sub subname
        Dim temp As New User
        Dim data As New List(Of User)
        For Each item As String In ListBox1.Items
            data.Add(New User(item))
        Next
    End Sub
End Sub

P.S. Yes, I’ve already read some posts about people having the same problem but did not understand how to apply their solution to my project.

  • 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-14T06:55:00+00:00Added an answer on June 14, 2026 at 6:55 am

    Your problem is the Shared property and private member. A Shared member is shared among all instances of the class. If you set it in one instance it will be the same for all instances.

    Private Shared n As String
    Public Shared Property Name() As String
      ...
    End Property
    

    Remove the keyword Shared and it should work as expected.

    Private n As String
    Public Property Name() As String
      ...
    End Property
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found myself with at little problem, and I think a custom model
I have a little problem with sorting out a list using an implementation of
I have a little problem. I use argparse to parse my arguments, and it's
I have a small little problem. I am have a drop down list that
I have a little problem understanding the Java language public class PhonebookEntryList extends List<PhonebookEntry>
i have a little problem. I'm trying to create in Delphi7 a list of
I have little problem. In first method of my code I've loaded data about
I stumpled across a little problem with a list of prices. I have a
I created a little jquery script and I have a problem to use (this)
I have a little problem with a left join where I want a list

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.