# Deals with various key topics in Xojo fundamentals

**URL:** <https://forum.xojo.com/t/deals-with-various-key-topics-in-xojo-fundamentals/71410>\
**Category:** Getting Started\
**Created:** [July 28, 2022, 7:58pm UTC](https://forum.xojo.com/t/deals-with-various-key-topics-in-xojo-fundamentals/71410 "2022-07-28T19:58:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_Fisher](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@Kenneth\_Fisher](https://forum.xojo.com/u/Kenneth_Fisher)\
**Post date:** [July 28, 2022, 7:58pm UTC](https://forum.xojo.com/t/deals-with-various-key-topics-in-xojo-fundamentals/71410/1 "2022-07-28T19:58:15Z")

</div>

I am using an array of a user defined object, and am having problems in assigning elements (AddRow). It makes all rows the same object, as the final one assigned.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [July 28, 2022, 7:59pm UTC](https://forum.xojo.com/t/deals-with-various-key-topics-in-xojo-fundamentals/71410/2 "2022-07-28T19:59:53Z")

</div>

What does your loop look like? It sounds like you’re not creating _new_ instances.

---

<div class="post-metadata">

**Author:** ![Jeff\_Tullin](https://forum.xojo.com/user_avatar/forum.xojo.com/jeff_tullin/32/693_2.png) [@Jeff\_Tullin](https://forum.xojo.com/u/Jeff_Tullin)\
**Post date:** [July 28, 2022, 8:36pm UTC](https://forum.xojo.com/t/deals-with-various-key-topics-in-xojo-fundamentals/71410/3 "2022-07-28T20:36:08Z")

</div>

your code will be

```auto
dim d as new myclass
dim a() as myclass
for x as integer = 1 to 5
d.somevalue = someamount
a.addrow d
next

```

d.somevalue = someamount just changes a property of the same instance.  
And you add the same instance over and over

You would change it to this:

```auto
dim d as myclass
dim a() as myclass
for x as integer = 1 to 5
d= new myclass //this is the key
d.somevalue = someamount
a.addrow d
next

```

---

<div class="post-metadata">

**Author:** ![Kenneth\_Fisher](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@Kenneth\_Fisher](https://forum.xojo.com/u/Kenneth_Fisher)\
**Post date:** [July 28, 2022, 9:57pm UTC](https://forum.xojo.com/t/deals-with-various-key-topics-in-xojo-fundamentals/71410/4 "2022-07-28T21:57:22Z")

</div>

Wow, Jeff that did it. Thank you so much. I had tried to work before with a New keyword, but I didn’t get the instance right like you showed me. Thanks for focusing right into my problems. Thanks and Kudos!
