Jump to content

Converting from VB to Delphi?


deep

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

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.