Wikia

Delphi Programming

Converting from VB to Delphi

2,918pages on
this wiki
Talk0

GENERAL KNOWLEDGE Edit

It would be a good idea to buy a Delphi book, to help you learn ObjectPascal syntax. Delphi programs are written using ObjectPascal. The basics for VB programmers:

  • line termination with semicolon: every statement must end with a semicolon.
  • assignment: You use colon-equals, like this: a := 1;
  • comparison: you can only use the equals without the colon, in comparisons, such as within an if statement: if (a=3) then doSomething;
  • variable types: Learn to use the basic ObjectPascal data types: Integer, Double, String, etc.
  • global variable declaration: You use the var section of a unit (a unit is a source code file) to declare globals
  • local variable declaration: you use the var section of a method or procedure or function to declare local variables
  • various control structures: familiarize yourself with for loops, while loops, if then else, and other control structures.
  • blocks with begin and end: familiarize yourself with the usage of begin and end.
  • object oriented programming: You should get used to object oriented programming, declaring and instantiating classes, and that kind of thing. A book helps out here. VB6 is not truly object oriented. Learn what that means. Unlearn damage caused by VB.
  • the Delphi Visual Component Library (VCL): familiarize yourself with the most common things you'll need to deal with in any VCL program, such as TForm, TButton, TListbox, TCombobox, TMemo, TEdit, and so on.



FAQs Edit

VB6 Delphi Comments
DoEvents Application.ProcessMessages
Control arrays N/A Delphi doesn't handle controls in the same way. Control arrays are essentially a "hack" to do some of the things that can easily be done in Delphi through a good object-oriented framework (VCL). For example, Delphi allows you to create components on the fly - something that would require control arrays in VB.
(see one approach to implementing "control arrays" in Delphi here: BDN Code Central Submission #15860)
MsgBox MessageDlg and ShowMessage
Dim VarVariable defination
Stub
This article is a stub.
Please help enhance the Delphi Programming Wiki by expanding it.

Around Wikia's network

Random Wiki