Help whit grid

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
martingz
Posts: 408
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Help whit grid

Post 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
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Help whit grid

Post 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
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
martingz
Posts: 408
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico

Re: Help whit grid

Post 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
Post Reply