[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

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.
0
zebada
Asked:
zebada
  • 3
1 Solution
 
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

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now