Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

converting delphi code to c#

8 views
Skip to first unread message

Bob99

unread,
Aug 2, 2007, 10:12:41 AM8/2/07
to
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



Marc Rohloff [TeamB]

unread,
Aug 2, 2007, 9:46:21 PM8/2/07
to
On Thu, 2 Aug 2007 15:12:41 +0100, Bob99 wrote:

> If anyone knows how to convert this or of a program which will do it that
> would be great.

I wrote an add in for Delphi which does this:
http://cc.codegear.com/Item/21834

You may need to recompile it for your version. Also some people have
had problems installing it automatically so you will have to modify
the registry key manually.

--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com

Bob99

unread,
Aug 3, 2007, 5:00:35 AM8/3/07
to
Will this work for Delphi 6 as that is what we are using?

Thanks

"Marc Rohloff [TeamB]" <"on request"> wrote in message
news:yj53ystgtdq4$.dlg@dlg.marcrohloff.com...

Marc Rohloff [TeamB]

unread,
Aug 3, 2007, 8:11:50 AM8/3/07
to
On Fri, 3 Aug 2007 10:00:35 +0100, Bob99 wrote:

> Will this work for Delphi 6 as that is what we are using?

No. But you should be able to get it to work on the Delphi 2006 trial
version or the Delphi.NET Turbo Pro edition.

Craig Stuntz [TeamB]

unread,
Aug 3, 2007, 10:53:50 AM8/3/07
to
Marc Rohloff [TeamB] wrote:

> On Fri, 3 Aug 2007 10:00:35 +0100, Bob99 wrote:
>
> > Will this work for Delphi 6 as that is what we are using?
>
> No. But you should be able to get it to work on the Delphi 2006 trial
> version or the Delphi.NET Turbo Pro edition.

Turbo won't take add-ins, will it?

Trial should, but you may need to recompile as I don't think the
binary format for an add-in is compatible with the non-trial version.

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from http://mers.com

Marc Rohloff [TeamB]

unread,
Aug 5, 2007, 2:01:55 PM8/5/07
to
On 3 Aug 2007 07:53:50 -0700, Craig Stuntz [TeamB] wrote:

> Turbo won't take add-ins, will it?
>
> Trial should, but you may need to recompile as I don't think the
> binary format for an add-in is compatible with the non-trial version.

AFAIK, Turbo Explorer doesn't but Turbo Pro does.

0 new messages