Hi,
I am using xojo 2023 r1.1,
I have a strange behaviour.
Dim wine, spirit, acc, cgr, bir, soju, sake, perennials, non_alco as double
Dim xRow,nRow,oCount As Integer
xRow=Listbox1.ListCount
oCount=0
For nRow=0 to xRow-1
Dim s As String
s=Listbox1.Cell(nRow,3)
s=s.left(2)
If s="AW" or s="BW" then 'wine
wine = wine + CDbl(Listbox1.Cell(nrow, 5))
end if
If s="AS" or s="BS" Then 'spirit
spirit = spirit + CDbl(Listbox1.Cell(nrow, 5))
end if
If s="AB" or s="BB" Then 'beer
bir = bir + CDbl(Listbox1.Cell(nrow, 5))
end if
If s="AG" Then
cgr = cgr + CDbl(Listbox1.Cell(nrow, 5))
end if
if s ="AC" then ' aksesoris
acc = acc + CDbl(Listbox1.Cell(nrow, 5))
end if
if s ="AJ" or s ="BJ" then ' soju
soju = soju + CDbl(Listbox1.Cell(nrow, 5))
end if
if s ="AE" or s ="BE" then ' Sake
sake = sake + CDbl(Listbox1.Cell(nrow, 5))
end if
if s ="MM" or s ="MP" then ' Perennials
perennials = perennials + CDbl(Listbox1.Cell(nrow, 5))
end if
if s ="AL" or s ="FD" or s ="AQ" then ' non alco
non_alco = non_alco + CDbl(Listbox1.Cell(nrow, 5))
end if
Next nRow
lw.text= str(wine)
lw.text=format(wine,"###,##0")
ls.text= str(spirit)
ls.text=format(spirit,"###,##0")
lcg.text= str(cgr)
lcg.text=format(cgr,"###,##0")
la.text= str(acc)
la.text=format(acc,"###,##0")
lb.text= str(bir)
lb.text=format(bir,"###,##0")
lj.text= str(soju)
lj.text=format(soju,"###,##0")
le.text= str(sake)
le.text=format(sake,"###,##0")
lp.text= str(perennials)
lp.text=format(perennials,"###,##0")
lNA.text= str(non_alco)
lNA.text=format(non_alco,"###,##0")
dim dd as Integer
for dd=ListBox1.Listcount-1 downto 0
select case Listbox7.cell(dd,0)
case "Wine"
Listbox7.cell(dd,1)=lw.text
case "Spirit"
Listbox7.cell(dd,1)=ls.text
case "Sake"
Listbox7.cell(dd,1)=le.text
case "Soju"
Listbox7.cell(dd,1)=lj.text
case "Beer"
Listbox7.cell(dd,1)=lb.text
case "Accessories"
Listbox7.cell(dd,1)=la.text
case "Perennials"
Listbox7.cell(dd,1)=lp.text
case "Non Alco"
Listbox7.cell(dd,1)=lNA.text
case "Cigar"
Listbox7.cell(dd,1)=lcg.text
end select
Next
I am putting the code in listbox1 celltextpaint
its worked, but only if its follow the list sequence in listbox7. I meant, If I add the row into listbox1 based from the listtbox7 sequence will work.
What I need is random, any new rows with the specific code should work and categorized in listbox7.
I have tried to change the loop into
for dd = 0 to listbox1.listcount -1
also not working.
any helps?
thanks
arief