Please help me with this problem!
I am new with Delphi, and arrays I just can't understand
I need to write program that contain the arrays for colours
My first problem is to increment the colour count
Those are my declarations
procedure btnSelectClick(Sender: TObject);
private
{ Private declarations }
CountSelection : array [1..7] of integer ;
public
{ Public declarations }
nCount : Integer;
end;
var
frmRainbow: TfrmRainbow;
const
TheRainbow : array [1..7] of string = ('Red', 'Orange',
'Yellow', 'Green', 'Blue', 'Indigo','Violet');
I declared the nCount in the event FormCrate
procedure TfrmRainbow.FormCreate(Sender: TObject);
var
nCount : Integer;
begin
for nCount := 1 to 7 do
CountSelection[nCount] := 0;
Randomize;
end;
and then on btnSelectClick I add code
var
nSelect : Integer;
nTotal : Integer;
Index : integer;
begin
//A
//Select a random number to identify the colour selected//this works
//increment the colour count//???
nCount := 0;
nCount := nCount + 1;
lblNumberSelections.Caption := 'Number of Selectons: '
+ IntToStr(nCount);
but it will only increment by one. What I am doing wrong?
Then I must add counts for each of the colours (stored in the array) and determine the number of colour selections made thus far. How?????????
My next problem is showButton: It clears the existing display in the ListBox, and then displays the counts for each of the colours as stored in the array. Items are added to the ListBox
And then where the user will click on the reset button it must zero each of the array.
Please help me!!!!!!!!!!!!!
Could you suggest any good book (or site on the internet)with planty of examples for programs written in Delphi. It could help me a lot.
thanks to eveybody who could help me!!!!!!!!