Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.NET class in Delphi.NET

Posted on 2006-11-25
6
Medium Priority
?
296 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Integration Management Part 2
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

927 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