calculating value in listbox

I was trying to calculate value in a listbox’s cell, no error shows, but it wont work,

[code] dim ox as integer
for ox=0 to ListBox1.Listcount-1
dim g as integer

if  g<=100000 then
  if g>0 then
  end if
end if

without this line its worked, if g>0 then
but i want to calculate it, if the columns not empty or zero

anything that i missed ?


Check directly if the Cell is empty (or not)…

If Listbox1.cell(ox,7) = "" Then // Empty Cell

You can also check if the Cell contents is a number…

If IsNumeric(Listbox1.cell(ox,7) Then // true if value is numeric

Check syntax.

@Arief Sarjono — Just a quick tip, since you get started with Xojo. You can join the Dim and For statements like this:

for i as Integer=0 to ...

The only difference is that the loop variable will be valid within the loop only

I think you want:

if g = 0 then

Since g=val(Listbox1.cell(ox,7)) will be zero if the cell is blank.

I prefer having a reference to an existing object of a representive type according to the listbox columns , stored in the rowtag of each row, and have all properties in their logical type-format. You prevent a lot of listbox issues while populating, storing and editing.


Thanks for all the helps,

its worked now.