Jump to content

Search the Community

Showing results for tags 'general help'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. Hey guys, so for this program I'm writing I want to check a string grid for empty rows/rows with just spaces in them and then subsequently deleting them to clean the grids up a bit. I made a procedure that reads the fields from a specific table in a DB and into a corresponding string grid. While 13 of the 14 grids I have, read the records like they're supposed to from the DB, one single table doesn't read correctly, it reads the same amount of records again as empty rows when displayed on the grid. For example, let's say I have 3 records in the table in the DB and I read it into the grid, the records display properly but then they add 3 more rows with just spaces in them. My code for this so far: procedure TfrmPuntehou.IncreaseRowCount(grid: TStringGrid); begin //increases rows in grid grid.RowCount:= grid.RowCount+1; end; procedure TfrmPuntehou.WriteToList(tbl: TADOTable;grid:TStringGrid); var Row: Integer; i: Integer; begin tbl.Active:= True; Row := 1; // Populate cells Tbl.First; while not (Tbl.Eof) do begin grid.Cells[0,Row]:= IntToStr(Row); grid.Cells[1,Row]:= tbl.fields[0].AsString; grid.Cells[2,Row]:= tbl.fields[1].AsString; grid.Cells[3,Row]:= tbl.fields[2].AsString; Inc(Row); IncreaseRowCount(grid); Tbl.Next; end; tbl.Active:=false; //what I'm planning to do to alleviate this but I'm not sure to use in the conditions of the if // because if I say grid.Rows[i] = ''/grid.Rows[i] = ' ' then I get an error // for i := 1 to grid.RowCount - 1 do // begin // if () OR () then // begin // grid.Rows[i].Delete; // end; // end; end; Illustration of what I'm talking about: What is supposed to happen: What's happening (the records are inserted correctly, but there are unnecessary rows here for only 3 records. When exported to a CSV the empty rows are filled with spaces"): Thanks in advance for any help on this! Kind Regards PrimeMinister
×