TStringGrid.DeleteRow????

If x is of type TStringGrid, how can I do this:

x.DeleteRow(rownum);

without getting a compile time error:
Undeclared identifier: 'DeleteRow'

DeleteRow is a protected method of TCustomGrid from which TStringGrid is derived.
LVL 6
zebadaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LischkeCommented:
I don't know why this method isn't declared as public but with a little trick you can make it visible to your application:

type
  TMyGrid = class(TCustomGrid)
  public
    procedure DeleteRow(ARow: Longint);
  end;


then in your code use:

  TMyGrid(x).DeleteRow(rownum);

Ciao, Mike
0
LischkeCommented:
Oops, sorry, I made a little mistake. You should change the declaration to:

type
  TMyGrid = class(TCustomGrid)
  end;

Looks funny, but works :-)

Ciao, Mike
0
zebadaAuthor Commented:
Thanks Mike,
Although I haven't tried it yet.

In a round-a-bout sort of way I am actually doing this already.
Thanks for the confirmation :)
Answer for points.
0
LischkeCommented:
It is not against any rule and it works, so I wouldn't care about another solution (unless you need an own control anyway).

Ciao, Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.