|
|||||
|
This part of the Basic Zone is for the ex-VB-programmers. I mean, the ones that left the world of vb in favour for the world of Delphi. In my opinion, you have done the right thing.
I actually never programmed in Visual Basic, but I read a few books about it (in the beginning, when I hadn’t heard about Delphi yet, and I decided to start programming, I bought a few Vb books). So What’s the big difference between Vb and Delphi ? Apart from more power, more speed and the total lack of additional files? Well, nothing much, really. Of coarse, it’s a completely different Interface. Lets go over the most common differences. If you don’t find what you need in these pages, Delphi 2 comes with an excellent Help file for Ex-Vbers.
First of all, what you used to call subs are now procedures. Functions stay functions. Most variable names are the same but Delphi has more subtypes. Take notice that the Object-Pascal language on which Delphi is based, can’t do automatic conversions so don’t be surprised to get errors on that ( I especially had difficulties with the difference between pchar and String, If you need a pchar and you have a string, just put pchar in front of it like this : pchar(string) )
Events are situated on the right tab of the "object explorer" with which you can also edit properties ( by the way : the shortcut for the object explorer is F11 and not F4 like in VB !). If you double-click this events, Delphi will create a new procedure for it ( like procedure Form1.Button1Click(...) ). All procedures in Delphi are put right after each other in a unit, the Delphi equivalent of a module.
Ever wondered how to ‘dim’ variables in Delphi ? Just do it in the var section of your procedure. You create a var section by simply adding the var reserved word before the Begin reserved word and then defining the variables, using a colon ( : ) instead of as. Like this :