Solved

VB.NET class in Delphi.NET

Posted on 2006-11-25
6
290 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

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

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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