Object value overwritten

  • Thread starter Thread starter RichardDunneBSc
  • Start date Start date
R

RichardDunneBSc

Guest
I have a class with a List. I'm creating a list of values entered into a textbox. When I add the first value, the object count is 1 and contains the value entered. I clear the textbox after each object. After creating a second object, the object count is 2. The problem is Object1 value is the same as Object2 value, which they shouldn't be

Class object = new Class();
object.SetValue(textbox.text);
Class.object.Add(object);
textbox.text = "";

I have done the same with another class list without issue. It was working before and I haven't changed the code. Is this known to happen?

Continue reading...
 
Back
Top