# Change listbox column?

**URL:** <https://forum.xojo.com/t/change-listbox-column/17125>\
**Category:** Databases\
**Created:** [June 8, 2014, 3:27pm UTC](https://forum.xojo.com/t/change-listbox-column/17125 "2014-06-08T15:27:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [June 8, 2014, 3:27pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/1 "2014-06-08T15:27:14Z")

</div>

Hi,  
I have been looking at this for too long and now have mental block ☹

The code below puts the value of a database column called “Title” into column 0 of my single column listbox.  
If I now include another column in the listbox - how do I get the value inserted into column 1, instead of column 0??

` // POPULATE THE LISTBOX
      while not rs.eof
        MainWindow.Listbox1.addRow rs.Field("Title").StringValue
        rs.moveNext
      wend`

Thank you all in advance.

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [June 8, 2014, 3:36pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/2 "2014-06-08T15:36:46Z")

</div>

You can add another parameter to AddRow or

```auto
Cell( LastIndex, 1) = ...
```

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [June 8, 2014, 3:44pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/3 "2014-06-08T15:44:06Z")

</div>

Thanks Kem,  
Do you mean like this?

`// POPULATE THE LISTBOX
while not rs.eof
Listbox1.AddRow
Listbox1.Cell(Listbox1.LastIndex, 1) = rs.Field("Title").StringValue      
rs.moveNext
wend`

I can’t actually test it as I am on my iPad, and am just trying to use my time wisely and learn during my train journey 🙂

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [June 8, 2014, 5:15pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/4 "2014-06-08T17:15:25Z")

</div>

Yes, or

```auto
AddRow "", Title
```

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [June 8, 2014, 5:16pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/5 "2014-06-08T17:16:39Z")

</div>

Wow - I actually combined some code correctly - that must be a first 🙂

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [June 8, 2014, 6:08pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/6 "2014-06-08T18:08:21Z")

</div>

> [@97497:@Richard Summers](#):
>
> Wow - I actually combined some code correctly - that must be a first 🙂

Congratulations, Richard. Judging from your attendance on the forum, you have been quite immersed in Xojo lately. It is starting to bear fruits 🙂

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [June 8, 2014, 6:14pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/7 "2014-06-08T18:14:11Z")

</div>

Michel - I have mostly been talking complete and utter nonsense in the pet peeve forum, as a distraction after finding my mum dead.  
However, I have also been trying to learn as much as possible, and now have a much better grasp of the language.

I have noticed that I seem to be better at the more complex problems than I am with the simple stuff ???  
Trust me to be different ! 🙂

Thanks for the kind words.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:15pm UTC](https://forum.xojo.com/t/change-listbox-column/17125/8 "2020-10-29T17:15:42Z")

</div>


