Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Old 01-07-2001, 10:39 AM
Matze Matze is offline
Junior Member
Join Date: Jan 2001
Posts: 1
Default TStringGrid

I have a problem to delete rows from a TStringGrid.
I used :

TStringGrid1.Rows[1].delete(1) and received an error. (cannot delete or insert...)

What can I do. ?
Reply With Quote
Old 01-07-2001, 11:01 AM
ADMack ADMack is offline
Junior Member
Join Date: Nov 2000
Posts: 21
Default RE: TStringGrid

I : Integer ;
StringGrid1.Row := 2 ; // where 2 = Row To Delete
If StringGrid1.Row = StringGrid1.Row - 1 Then
// Row to delete is the last row in the string grid
StringGrid1.RowCount := StringGrid1.RowCount - 1
// NOT the last row in the stringgrid
For I := 2 To StringGrid1.Rowcount - 1 Do
StringGrid1.Rows[I] := StringGrid1.Rows[I+1] ;
StringGrid1.RowCount := StringGrid1.RowCount - 1 ;
End ;
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 12:07 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.