Solved

VB.NET class in Delphi.NET

Posted on 2006-11-25
6
289 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

803 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