Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

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

Hi.
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
  #2  
Old 01-07-2001, 11:01 AM
ADMack ADMack is offline
Junior Member
 
Join Date: Nov 2000
Posts: 21
Default RE: TStringGrid

Var
I : Integer ;
begin
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
Else
Begin
// 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 ;
end;
Reply With Quote
Reply

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 01:54 AM.


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