Differenze tra
Visual Basic 6.0 e Gambas2
|
Codice
VB6 |
Codice
Gambas2 |
Commento
Gambas2 |
|
msgbox(valore
as string) |
message(valore
as string) |
|
|
Ciclo For |
|
|
|
for
i= a to b ... next
i |
For i=
a to b ... next |
|
|
Lst.additem |
Lst.add(valore
as string) |
Aggiungere
valori a oggetto lista |
|
If
condizione then ... elseif
condizione then ... end
if |
If
condizione then ... else if condizione then ... end if end
if |
|
|
|
||
|
Public
sub exit_click() unload
me end
sub |
Public
sub exit_click() quit end |
Chiusura
applicativo |
|
Public
function a(Byval p1 as ..., Byref p2 as ...) as datatype ... a=valore
as datatype end
function |
Public
function a(p1 as ...,Byref p2 as ...) as datatype ... return(a
as datatype) end |
Passaggio
parametri per riferimento o valore |
|
Dim
a() as integer |
Dim
a as integer[] |
Dichiarazione
array |
|
|
||
|
Classi |
|
|
|
Modulo
di classe:Nome classe Private
numero as integer Private
vettore() as double Public
b as double Property
get num() as integer num=numero end
property Property
let num(Byval valore as integer) numero=valore end
property Property
get vett() as double() vett=vettore end
property Property
let vett(Byval a() as double) vettore=a end
property Note:
con Visual Basic 6 ereditarietà e polimorfismo non sono possibili anche se
sono stati implementati in Visual Basic .NET |
Modulo
di classe:Nome classe1 Private
numero as integer Private
vettore as string[ ] Public
b as float Property
num as integer Property
vett as string[ ] Private
function num_read() as integer return(numero) end
Private
sub num_write(valore as integer) numero=valore end Private
function vett_read() as string[ ] return(vettore) end Private
sub vett_write(valore as string[ ]) vettore=valore end Public
Function calcola() as integer ... return(...) end Modulo
di classe:Nome classe2 Inherits
Nome classe1 Private
dati as integer Property
dat as integer Private
function dat_read() as integer return(dati) end
Private
sub dat_write(valore as integer) dati=valore end Public
Function calcola() as integer return(me.dat
+ super.num) end Static
Public Function tostring() as string ... return(...) end
Form: Public
ogg2 as Nome Classe2 Public
ogg1 as Nome Classe1 Public
sub _new() ogg2=
new Nome Classe2 ogg1=new
Nome Classe1 end message(cstring(ogg1.calcola())) message(cstring(ogg2.calcola())) message(cstring(Nome
Classe2.tostring())) |
Attriburo
privato Array Property
per accedere agli attributi Funzione
per leggere Procedura
per scrivere Eredita
attributi e metodi da Nome classe1 Polimorfismo Metodo
con ambito di classe Dichiarazione
oggetti Creazione
oggetti Polimorfismo Metodo
con ambito di classe |