Page 1 of 1

Help whit grid

Posted: Wed May 05, 2010 6:32 pm
by martingz
I use a grid control for display some information
control is fed with data from a table and can be variable
between every operation I empty the grid
but on some occasions is fine and sometimes not
remain 1 o 2 lines

i use next code to empty

mconst:=conspag.Grid_1.ItemCount
for t=1 to mconst
conspag.Grid_1.DeleteItem(t)
next

sorry for my bad english

Re: Help whit grid

Posted: Wed May 05, 2010 6:57 pm
by Rathinagiri
First of all we have a special method to delete all items, so, you can use,

conspag.Grid_1.deleteallitems()

In the case of your example, once you delete the first item, second item becomes the first item! So, that will be a problem.

The correct logic would be

mconst:=conspag.Grid_1.ItemCount
for t= mconst to 1 step -1
conspag.Grid_1.DeleteItem(t)
next

Re: Help whit grid

Posted: Wed May 05, 2010 7:10 pm
by martingz
Tanks rathingari
i don't find about deleteallitems() info
i check my documentation probably is bad o old

thanks again for your help