Article View: borland.public.csharpbuilder.language.csharp
Article #145converting delphi code to c#
From: Bob99
Date: Thu, 02 Aug 2007 14:12
Date: Thu, 02 Aug 2007 14:12
62 lines
2481 bytes
2481 bytes
Hi,
I've got some Delphi code that I need to convert c#, the code is used in a
timer to delete an entry from a TListView in Delphi.
The Delphi code is below:
procedure TfrmALSECServer.tmrALSECTimer(Sender : TObject);
var
i : Integer;
Item : TListItem;
obj : TMyObj;
begin
try
for i := vListView.Items.Count - 1 downto 0 do
begin
Item := vListView.items[i];
obj := TMyObj(Item.data);
if (now - obj.rqTime) > {(1.0 / (24 * 60 * 3)) then//}(1.0 / 24) then
begin
//dispose of record after 1 hour
obj.Free;
vListView.items.Delete(i);
end
end;
//switch off timer if list empty.
if (vListView.Items.Count = 0) then
tmrTimer.Enabled := False;
Except
on e : exception do
begin
ShowMessage('tmrTimer: '+e.message);
end;
End;
end;
The Object and Record used are below:
TMyObj = class(TObject)
id : Integer;
rqTime: TDateTime;
info : TMyDetails;
end;
TMyDetails = record
cValidInfo : Boolean;
Line1 : Widestring;
Line2 : Widestring;
Line3 : Widestring;
....
....
....
Line22 : Widestring;
Line23 : Widestring;
Line24 : Widestring;
end;
If anyone knows how to convert this or of a program which will do it that
would be great.
Thanks
Technical Details
Message-ID:
<46b1e642$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,d284bcadc1596ec9,start X-Google-Attributes: gid1efe35,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Bob99" <nospam@nospam.com> Newsgroups: borland.public.csharpbuilder.language.csharp Subject: converting delphi code to c# Date: Thu, 2 Aug 2007 15:12:41 +0100 Keywords: < Not Specified > Lines: 62 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Live Mail desktop 8.0.1226 X-MimeOLE: Produced By Microsoft MimeOLE V8.0.1226 NNTP-Posting-Host: 213.249.229.58 Message-ID: <46b1e642$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1186063938 213.249.229.58 (2 Aug 2007 07:12:18 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail X-Original-Bytes: 2332