![]() Procedure TForm1.Button1Click(Sender: TObject) See note above for info about lack of error checking code. Deletes row 1 from the stringgrid every time it's clicked StringGrid1.Cells := Format('C: %d R: %d', ) StringGrid1.Cells := Format('Col %d', ) įor j := 1 to StringGrid1.RowCount - 1 do Procedure TForm1.FormCreate(Sender: TObject) įor i := 1 to StringGrid1.ColCount - 1 do Populates stringgrid with test data for clarity Interposer class, named to indicate it's use Your actual code should check the number of rows available before attempting to delete one. ![]() This is a demo application and not an example of production code. ![]() Note: The code does no error checking to make sure that there are enough rows. The button click event deletes row 1 from the stringgrid every time it's clicked. The TForm.OnCreate event handler simply populates the grid with some data to make it easier to see the deleted row. It uses a simple TStringGrid dropped on a form, with the default columns and cells, and a standard TButton. The following code has been tested in Delphi 2007. ![]() If you're using a standard VCL TStringGrid (without using the live bindings made available in recent versions), you can use an interposer class to access the protected TCustomGrid.DeleteRow method. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |