Solved

VB.NET class in Delphi.NET

Posted on 2006-11-25
6
288 Views
Last Modified: 2006-11-30
Hi,

I have a VB.NET class which I want to use in my Delphi.net web application.
Can this be done or do I have to rewrite the class in Delphi.NET?

Cheers
Nathan
0
Comment
Question by:nathc100
  • 3
  • 3
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18018716
You should be able to create a VB.NET DLL that you could reference in the Delphi application.

Bob
0
 

Author Comment

by:nathc100
ID: 18023397
Hmmm OK I'm thinking I'll just convert to Delphi the VB(it's actually VB not VB.NET) class isn't too long or complicated.
Do you have any experience with Delphi.NET and writing classes?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18026880
No, unfortunately I haven't had the time nor the inclination to learn.  It might be possible to convert the VB class to VB.NET, build a DLL, and then use Reflector + File Disassembler to get Delphi.NET code that would give you a place to start.

Bob
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:nathc100
ID: 18044028
OK Bob,

Here's a curly one if you can give me the answer I'll give you the points.
How do I convert the VB statement "Redim Preserve" into Delphi syntax?

e.g

Public Sub SetColumns(inNum)
  Dim i
  If inNum > 0 Then
    ReDim Preserve mWidths(inNum - 1)
    For i = (mColumns - 1) To (inNum - 1)
      If i >= 0 Then mWidths(i) = 1
    Next
    mColumns = inNum
  End If
End Sub
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 18044515
Here's my best guess (using Reflector):

procedure Form1.SetColumns(inNum: TObject);
var
      obj1: TObject;
      obj4: TObject;
begin
      if (Operators.ConditionalCompareObjectGreater(inNum, 0, false)) then
      begin
            self.mWidths := (Utils.CopyArray((self.mWidths as Array), New(array[(Conversions.ToInteger(Operators.SubtractObject(inNum, 1)) + 1)] of Integer)) as Integer[]);
            if (ForLoopControl.ForLoopInitObj(obj1, (self.mColumns - 1), Operators.SubtractObject(inNum, 1), 1, @(obj4), @(obj1))) then
                  repeat
                        if (Operators.ConditionalCompareObjectGreaterEqual(obj1, 0, false)) then
                              self.mWidths[Conversions.ToInteger(obj1)] := 1
                        until not ForLoopControl.ForNextCheckObj(obj1, obj4, @(obj1));
                  self.mColumns := Conversions.ToInteger(inNum)
            end
      end;

Bob
0
 

Author Comment

by:nathc100
ID: 18044633
Hey Bob,

I actually found a very easy way to do it just using SetLength(mWidths,inNum-1) as my array is dynamic.
But I'm true to my word so you get the points. Thanks for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now