Object_class Cheat Sheet
Object_class Cheat Sheet
Auxiliary
1. Step 5 // function DisplayInfo :
string ; - can have (parameters)
2. In function // write needed code
3. In function // result := info ;
4. NB ToString function ( step 5 ) //
ToString : string;
5. In function // result := fName + #9 +
displayInfo
Constructor
1. Step 5 // constructor Create
( sString : string ; iInteger :
integer ; )
2. In constructor // fName := sSstring;
EN fName := iInteger;
Destructor
1. Basically // objName.free;
Connecting data modules Messages
1. File new data module save rename if MessageDlg('Are you sure?', mtConfirmation,
2. ADOcon rename connectionString [mbYes, mbNo], 0) = mrYes then
loginprompt = false
3. ADOtbl rename connection TableName InputBox('Enter Name', 'What is your name?',
Active = true 'Default Name');
4. DataSource rename
5. DBGrid (under frm not dm ) under uses ShowMessage('Hello, ' + Name + '!');
dmName_u datasource
ShowMessage(Format('Name: %s, Age: %d',
SORTING = dmName.tblName.sort := ‘fieldName [name, age]));
ASC/DESC’;
Max Val Min Value
var
iLarge : integer; var
begin iSmall: integer;
with dmVisualArts do begin
begin tblArtEntries.First; with dmVisualArts do
iLarge:= -1; begin
while NOT tblArtEntries.eof do tblArtEntries.First;
begin iSmall := 999999; // Set to a very large initial
if tblArtEntries['LearnerNo'] > iLarge then value
iLarge := tblArtEntries ['LearnerNo'];
next ; while NOT tblArtEntries.Eof do
tblArtEntries.Next; begin
end; //while if tblArtEntries['LearnerNo'] < iSmall then
end; //with iSmall := tblArtEntries['LearnerNo'];
Result:= iLarge + 1;(max)
end; // method tblArtEntries.Next;
end; // while
end; // with
GGD KGV
begin begin
iNum1 := StrToInt(edtNum1.Text); iNum1 := StrToInt(edtNum1.Text);
iNum2 := StrToInt(edtNum2.Text); iNum2 := StrToInt(edtNum2.Text);
iLCM := 0;
while (iNum1 mod iNum2) > 0 do Repeat
begin iLCM := iLCM + iNum1
iRemain := iNum1 mod iNum2; Until (iLCM mod iNum2) = 0;
iNum1 := iNum2;
iNum2 := iRemain; lblResult.Caption := 'The LCM between ' +
end; edtNum1.Text + ' and ' + edtNum2.Text + ' is: '
+ IntToStr(iLCM);
lblResult.Caption := 'The GCD between ' +
edtNum1.Text + ' and ' + edtNum2.Text + ' is: ' +
IntToStr(iNum2);
end;