🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.csharpbuilder.language.csharp
6 messages
6 total messages Started by Bob99 Thu, 02 Aug 2007 14:12
converting delphi code to c#
#145
Author: Bob99
Date: Thu, 02 Aug 2007 14:12
62 lines
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

 
 
Re: converting delphi code to c#
#146
Author: Marc Rohloff TeamB
Date: Fri, 03 Aug 2007 01:46
15 lines
1648 bytes
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
Re: converting delphi code to c#
#147
Author: Bob99
Date: Fri, 03 Aug 2007 09:00
21 lines
1796 bytes
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...
> 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 
Re: converting delphi code to c#
#148
Author: Marc Rohloff TeamB
Date: Fri, 03 Aug 2007 12:11
10 lines
1553 bytes
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.

-- 
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
Re: converting delphi code to c#
#149
Author: Craig Stuntz TeamB
Date: Fri, 03 Aug 2007 14:53
19 lines
2058 bytes
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
Re: converting delphi code to c#
#150
Author: Marc Rohloff TeamB
Date: Sun, 05 Aug 2007 18:01
12 lines
1587 bytes
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.

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

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads