TStringGrid

i have a StringGrid and i want in runtime to delete a column! (or to move it to the end and then to do coulcount:=colcount-1 => deleted)
how can i do it?
LVL 1
ntonyAsked:
Who is Participating?
 
kretzschmarConnect With a Mentor Commented:
as said typos possible
(because i have no delphi on hand)
try
cols
instead

meikl ;-)
0
 
kretzschmarCommented:
for i := delIndex to stringgrid1.colcount -2 do
  stirngrid1.columns[i].assign(stirngrid1.columns[i+1]);
stringgrid1.colcount := stringgrid1.colcount-1;

delindex is the zerobased index of the column which is to delete

just from head (not tested, typos possible)

meikl ;-)
0
 
ntonyAuthor Commented:
error
StringGrid.Columns[i]   // undeclared identifier 'columns'
0
 
ntonyAuthor Commented:
tanks it's working
0
 
kretzschmarCommented:
glad to helped you :-)
good luck again

meikl ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.