Hello Everybody,
I'm trying to make working this code:
B4X:
Sub Globals
Public Type(Codice,Nome,Targa) Veicoli
End Sub
Sub App_Start
Ricerca.Form2.Show
End Sub
Public Sub Veicolo(Codice)
Veicoli.Codice=Codice
Veicoli.Nome="Franco"
Veicoli.Targa="ES265CK"
Return Veicoli()
End Sub
My need is to call the sub Veicolo(Codice) from other modules just like this:
B4X:
Sub Globals
Public Type(Codice,Nome,Targa) Macchina As String
End Sub
Sub Form2_show
macchina()=main.Veicolo("1234")
Msgbox (macchina.Codice & Chr(13) & macchina.Nome & Chr(13) & macchina.Targa)
End Sub
What exactly do you want to do ?
This is wrong: Public Type(Codice,Nome,Targa) Veicoli
It should be: Public Veicoli Type(Codice As ???, Nome As ???, Targa As ???)
In the Type declaration you must set the variable type !
Then you need to dim a variable of this type.
You might have a look at chapter 10.3.4 Type variables in the Beginner's Guide.
I found a solution:
-Remove argument from 'Return'
-modify code calling sub like this:
B4X:
Sub Globals
Public Type(Codice,Nome,Targa) Macchina As String
End Sub
Sub Form2_show
main.Veicolo("1234")
macchina()=main.Veicoli()
Msgbox (macchina.Codice & Chr(13) & macchina.Nome & Chr(13) & macchina.Targa)
End Sub
What exactly do you want to do ?
This is wrong: Public Type(Codice,Nome,Targa) Veicoli
It should be: Public Veicoli Type(Codice As ???, Nome As ???, Targa As ???)
In the Type declaration you must set the variable type !
Then you need to dim a variable of this type.
You might have a look at chapter 10.3.4 Type variables in the Beginner's Guide.
Are you speaking about Basic4PPC or Basic4Android?
Where did you find DimType(Name, ID, Age) person ?
If you enter Type in the Search Box you'll get the answer on top.
Are you speaking about Basic4PPC or Basic4Android?
Where did you find DimType(Name, ID, Age) person ?
If you enter Type in the Search Box you'll get the answer on top.