Can you insert a value into Listbox cell

My apologies for asking for help but I’m running into a lot of “Page Not Found” and some depricated text so I’m not certain I can do the following:

I add a column of values in a listbox (you help appreciated) and now would like to enter the value derived from the addition into a specific cell in a list box separate from the first used to calculate the value. I have tried the following code:
ListBox.CellValueAt(Row Number as Integer, Column Number as Integer
ListBox1.Cell(1,1) = I tried text, the result as an integer with no results.
ListBox1.Cell(0,1) = str(x)

There is a lot of information of adding rows to list box but what I’m trying to do is insert number values into existing list box cells? Maybe it can’t be done and that is my problem.

Any help or direction as to where to find information or code would be appreciated. Thank you again.

Hi James, can you provide more information so we can better help you?

Things like:

  • what Xojo version
  • if you are using a regular Listbox or a DesktopListbox (you can find which by looking at the Super)
  • where are you using the code you posted
  • can you include an image of your working app (with the 2 listboxes and maybe you have a button to do the sum and insert the result into the second listbox?)

also, can you use ``` before and after your code so it gets formatted for easier reading? or you can use the icon that looks like this </> above your text when you are creating a new post.

Edit: My guess is that you want something like this


and after pressing the button

but maybe this is not what you want.

The code in the Button is what you already have to Sum the listbox1 and only to write the cell in listbox2 I used:

Listbox2.CellTextAt(0,1) = suma.ToString

Note: I’m using DesktopListbox for this example

1 Like

Thank you for the reply. Based on what you’ve sent I realized that what I was trying to do can not be done as I have a conflict in the coding; trying to do too much causing interferences. Back to the drawing board. Thanks again.