Showing posts with label Delphi. Show all posts
Showing posts with label Delphi. Show all posts

Thursday, October 30, 2008

Incompatible types: 'Integer' and 'Extended'

muncul pesan error seperti diatas ketika melakukan kondisi pembagian.

contoh :

var
value1, value2 , result : integer;

value1 := 2;
value2 := 3;
result := value1 / value2;


ketika aplikasi running maka kompilasi akan gagal dan muncul pesan error "Incompatible types: 'Integer' and 'Extended'"

seharusnya pada :
result := value1 / value2;



dirubah menjadi
result := value1 div value2;


Read More..

Sunday, October 26, 2008

How to connect a csv file to Delphi

Can a comma delimited file, (*.csv) be viewed through delphi? If so, what components, settings, and code are used?



If you just want to view the text, drop a memo onto a form and call

memo1.Lines.LoadFromFile( 'c:\mycsv.csv');

Another option maybe you want to load it into a stringgrid

var
i, j: integer;
slFile, sl: TStringList;
begin
try
slFile := TStringList.Create;
slFile.LoadFromFile( 'c:\mycsv.csv');

with stringgrid1 do
try
rowcount := slFile.Count;
FixedCols := 1;
FixedCols := 0;

for i := 0 to slFile.count - 1 do
begin
sl := TStringList.Create;
sl.Delimiter := ',';
sl.DelimitedText := slFile.strings[ i];

for j := 0 to sl.count - 1 do
Cells[ j, i+1] := sl.Strings[ j];
end;
finally
freeAndNil( sl)
end;
finally
freeAndNil( slFile)
end;
end;

rowcount := slFile.Count;
should probably be rowcount := slFile.Count+1 to allow for header row

source : http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_22904840.html

Read More..

DsgnIntf Unit di CodeGear 2007

Suatu ketika kita ingin menginstall komponen yang pada uses unitnya ada menggunakan DsgnIntf Unit, maka yang muncul adalah pesan error bahwa file tidak ada.



Memang pada codegear DsgnIntf Unit sudah tidak ada lagi, unit itu hanya ada pada Delphi 5 kebawah.

Anda bisa mengganti DsgnIntf Unit dengan DesignIntf dan DesignEditors Unit pada usesnya. Serta tambahkan designide.dcp pada package Required.

Read More..

Saturday, October 25, 2008

Limitation of TStringList

By: Angel Martinez

Abstract: Explains the number of Strings a TStringList can hold

Question:

What are the size limitations of a TStringList?




Answer:

TStringList can hold up to 134,217,728 strings (MaxListSize+1). There are no limits on the size of the string (other than physical memory limits and processor address space limits).
source : http://dn.codegear.com/article/30333

Read More..