Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2004

Tip: Looking for answers? Try searching our database.

Strongly Typed Collection Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
walterd - 23 Sep 2004 23:58 GMT
Hi All

I have a class Persons that hold key/value pairs of Person class. My problem
is the following.
On the first screen I create an instance of Person, I then add a name and
surname and then add the class to class Persons ( I can add more than one
Person class on this screen). On the next screen I retrieve the Person I am
interested in and add Home Address or whatever I wish to add.
The problem starts when I call the Add method of the Persons class. The
value (Person that's been updated) is never stored or updated in the Persons
class.

public object Value
{
  get{return this.mValue;}
  set
  {
       if (this.mValue != value)
       {
        this.mValue = value;
       }
  }
}

Can some give some green light?
Drebin - 24 Sep 2004 00:35 GMT
I sounds like you should really just have a Person class and use an indexer,
so you could then reference:

Person personBob = objPerson["Bob"];
// or
Person personBob = objPerson[0];

I may not fully understand what you are trying to accomplish. Is it possible
to post a working snippet of code??

> Hi All
>
[quoted text clipped - 21 lines]
>
> Can some give some green light?
Jonathan Allen - 25 Sep 2004 07:47 GMT
>    set
>    {
[quoted text clipped - 3 lines]
>         }
>    }

Why are you doing this?

Signature

Jonathan Allen

> Hi All
>
[quoted text clipped - 21 lines]
>
> Can some give some green light?
Daniel Billingsley - 25 Sep 2004 13:57 GMT
Why are you trying to add the Person to the collection again?

> Hi All
>
[quoted text clipped - 21 lines]
>
> Can some give some green light?
Nick Malik - 26 Sep 2004 07:03 GMT
The get/set below is not your problem...

You said that the updated value is never added to the collection.
(a) which collection object are you using?  Hashtable?
(b) how are you indexing the value in the collection?
(c) you mention that you find the Person on the next screen, but you do not
mention if you try to update it, or overwrite it, or just add it again.
Could it be that your attempt to add it again is failing, and that you are
ignoring the error?

--- Nick

> Hi All
>
[quoted text clipped - 21 lines]
>
> Can some give some green light?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.