Thread: Help with table

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Help with table


    I am trying to create a points table for my program, but have no idea on how to do it, i would appreciate all the help possible ,thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    155
    Rep Power
    3
    Provide more information to get better response. For now we only knew that you want to create a points table. None has any idea what the heck is points table, why do you need it, and how are you going to use it.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    sorry about the lack of information, i am creating a system for a cricket club for a project, i am struggling on how how get data for the table, i have created a form which allows users to enter the fixtures list and also another form which allows teams to be added. my problem is that i don't know how to get this data into a table and the first team is the team with the most points.
    hope this helps .
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    5
    Rep Power
    0
    You Still haven't provided that much info. But below is something that I started, The Structure for creating a table is there, mine is for the Premier League. But Currently the program lacks any real Programming. Hope something below is of use to you. By any chance is this for an A2 Computing Project.

    unit premierleague;

    interface

    uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.StdCtrls,
    Vcl.Samples.Spin;

    type
    TfrmLeagueTable = class(TForm)
    sgrdTable: TStringGrid;
    sedtHomeScore: TSpinEdit;
    lboHomeTeam: TListBox;
    lboAwayTeam: TListBox;
    sedtAwayScore: TSpinEdit;
    lblHome: TLabel;
    lblAway: TLabel;
    btnResult: TButton;
    btnGetResult: TButton;
    procedure FormCreate(Sender: TObject);
    procedure btnResultClick(Sender: TObject);
    procedure btnGetResultClick(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    frmLeagueTable: TfrmLeagueTable;
    LeagueTable : Array [1..10,1..20] of string;
    Teams : Array [1..20] of String;

    implementation

    {$R *.dfm}

    procedure TfrmLeagueTable.btnGetResultClick(Sender: TObject);
    Var Count, Temp : Integer;
    begin
    for Count := 1 to 90 do
    begin
    Temp := Random(1000)+1;
    if (Temp < 16)
    then sedtAwayScore := sedtAwayScore + 1;
    end;
    for Count := 1 to 90 do
    begin
    Temp := Random(1000)+1;
    if (Temp < 16)
    then sedtHomeScore := sedtHomeScore + 1;
    end;
    end;

    procedure TfrmLeagueTable.btnResultClick(Sender: TObject);
    begin
    if lboHomeTeam.ItemIndex = lboAwayTeam.ItemIndex
    then ShowMessage ('The Home and Away teams are the same');
    end;

    procedure TfrmLeagueTable.FormCreate(Sender: TObject);
    Var Count1, Count2 : Integer;
    begin
    sgrdTable.Cells[0,0] := 'Position';
    sgrdTable.Cells[1,0] := 'Team';
    sgrdTable.Cells[2,0] := 'Played';
    sgrdTable.Cells[3,0] := 'Won';
    sgrdTable.Cells[4,0] := 'Draw';
    sgrdTable.Cells[5,0] := 'Lost';
    sgrdTable.Cells[6,0] := 'For';
    sgrdTable.Cells[7,0] := 'Against';
    sgrdTable.Cells[8,0] := 'GD';
    sgrdTable.Cells[9,0] := 'Points';
    sgrdTable.Cells[0,1] := '1';
    sgrdTable.Cells[0,2] := '2';
    sgrdTable.Cells[0,3] := '3';
    sgrdTable.Cells[0,4] := '4';
    sgrdTable.Cells[0,5] := '5';
    sgrdTable.Cells[0,6] := '6';
    sgrdTable.Cells[0,7] := '7';
    sgrdTable.Cells[0,8] := '8';
    sgrdTable.Cells[0,9] := '9';
    sgrdTable.Cells[0,10] := '10';
    sgrdTable.Cells[0,11] := '11';
    sgrdTable.Cells[0,12] := '12';
    sgrdTable.Cells[0,13] := '13';
    sgrdTable.Cells[0,14] := '14';
    sgrdTable.Cells[0,15] := '15';
    sgrdTable.Cells[0,16] := '16';
    sgrdTable.Cells[0,17] := '17';
    sgrdTable.Cells[0,18] := '18';
    sgrdTable.Cells[0,19] := '19';
    sgrdTable.Cells[0,20] := '20';
    LeagueTable[1,1] := 'Arsenal';
    LeagueTable[1,2] := 'Aston Villa';
    LeagueTable[1,3] := 'Chelsea';
    LeagueTable[1,4] := 'Everton';
    LeagueTable[1,5] := 'Fulham';
    LeagueTable[1,6] := 'Liverpool';
    LeagueTable[1,7] := 'Man. City';
    LeagueTable[1,8] := 'Man. United';
    LeagueTable[1,9] := 'Newcastle';
    LeagueTable[1,10] := 'Norwich City';
    LeagueTable[1,11] := 'QPR';
    LeagueTable[1,12] := 'Reading';
    LeagueTable[1,13] := 'Southampton';
    LeagueTable[1,14] := 'Stoke City';
    LeagueTable[1,15] := 'Sunderland';
    LeagueTable[1,16] := 'Swansea City';
    LeagueTable[1,17] := 'Tottenham';
    LeagueTable[1,18] := 'West Brom.';
    LeagueTable[1,19] := 'West Ham';
    LeagueTable[1,20] := 'Wigan';
    for Count1 := 2 to 9 do
    Begin
    for Count2 := 1 to 20 do
    Begin
    LeagueTable[Count1,Count2] := '0';
    End;
    End;
    for Count1 := 1 to 9 do
    begin
    for Count2 := 1 to 20 do
    begin
    sgrdtable.Cells[Count1,Count2] := LeagueTable[Count1,Count2];
    end;
    end;
    for Count1 := 1 to 20 do
    begin
    Teams[Count1] := LeagueTable[1,Count1];
    end;
    end;

    end.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    155
    Rep Power
    3
    Originally Posted by delphi user 118
    sorry about the lack of information, i am creating a system for a cricket club for a project, i am struggling on how how get data for the table, i have created a form which allows users to enter the fixtures list and also another form which allows teams to be added. my problem is that i don't know how to get this data into a table and the first team is the team with the most points.
    hope this helps .
    Seems like you need to learn how use database with Delphi. I wrote a few articles about database manipulation for delphi beginners. Read one of them here (it got links to other related articles).

IMN logo majestic logo threadwatch logo seochat tools logo