Avatar of ItsMe
ItsMe

asked on 

delete row from TSTringGrid

Hi !  How can I deleted teh selected row in an Stringgrid ? I'm using DElphi 4


regards
ItsMe
Delphi

Avatar of undefined
Last Comment
Igor UL7AAjr
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Hi ItsMe,

StringGrid1.Rows.Delete(StringGrid1.Row);

© ITugay
Avatar of ItsMe
ItsMe

ASKER

Hi ITugay ! I tried this before I askes, too. Delphi wants a parameter behind Rows[]

regards
ItsMe
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Hi again,

What's happen when hurry up, sorry. Try this:

SG - TStringGrid;

procedure TForm1.SpeedButton1Click(Sender: TObject);
var I : integer;
begin
   for I:=SG.RowCount-1 to SG.Row do
   SG.Rows[I-1].Assign(SG.Rows[I]);
   SG.RowCount:=SG.RowCount-1;
end;


Igor.
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

typo in previous sample, should be

procedure TForm1.SpeedButton1Click(Sender: TObject);
var I : integer;
begin
   for I:=SG.Row to SG.RowCount-1 do
   SG.Rows[I].Assign(SG.Rows[I+1]);
   SG.RowCount:=SG.RowCount-1;
end;
Avatar of ItsMe
ItsMe

ASKER

this just kills the last row.
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

hi ItsMe;)

Last sample should work, just check it.
Really, something wrong with me.

Igor.
Avatar of ItsMe
ItsMe

ASKER

i donno why but it doesn't :-( just the last line is deleted
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Hi ItsMe,

Last sample? It works fine for me, I just checked it agian. All OK.
May be you have selected row as last?

Do you mean "selected row" - row where is cursor, or you have range select ed?

Igor.
Avatar of ItsMe
ItsMe

ASKER

where is cursor.
ASKER CERTIFIED SOLUTION
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of ItsMe
ItsMe

ASKER

Comment accepted as answer
Avatar of ItsMe
ItsMe

ASKER

cool ! thanks now it works fine.
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

thanx;-)
Delphi
Delphi

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

60K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo