Jump to content

Converting from VB to Delphi?

Featured Replies

Visual Basic is a lot like Delphi, except for the syntax is different. Other than, it's all pretty much the same.

 

You can download a trial version of Delphi, at www.borland.com.

 

Lets look at a few examples...

 

Comments are the easiest thing in the world to accomplish.

 

Visual Basic:

' Your comment goes here.

 

Delphi:

// Your comment goes here.

 

 

That's not hard to follow, moving on.

 

When declaring a varible in VB, you use the Dim statement, followed by the variable name, and then the data type.

 

Visual Basic:

Dim intVar As Integer, strVar As String

 

Delphi:

var intVar: Integer, strVar: String;

 

Simple enough, right? Notice the semi-colon, it indicates that the code on that line is finished. If you ever get a semi-colon error, look at the error line and the previous line to check for a semi-colon at the end.

 

Setting values, another easy task...

 

Visual Basic:

intVar = 255

strVar = "Text"

 

Delphi:

intVar:= 255;

strVar:= 'Text';

 

On to the last example (for now), If/Then Statements.

 

Visual Basic:

If intVar = 255 Then

' Do This

' And do this

End If

 

Delphi:

if intVar = 255 then

begin

// Do this

// And do this

end;

 

 

That's about all I feel like typing at the moment, I'll try to post more a little later.

  • 2 months later...

Deep is just preparing you, so you can switch to yet another crappy language. Delphi heh

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.