Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Type TyArt (Codice As String, Descrizione As String, Prezzo As Float)
Dim M As Map
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
M.Initialize
' Populate Map
For i=1 To 10
Dim Articolo As TyArt
Articolo.Initialize
Articolo.Codice=$"Cod-$6.0(i)"$
Articolo.Descrizione="Prodotto / Articolo"
Articolo.Prezzo=Rnd(1,200)/Rnd(1,5)
Dim Barcode As String = Rnd(100000,999999)
M.Put(Barcode,Articolo)
Next
'ricerca
If RicercaBarCode(Rnd(100000,999999))<>Null Then
Log("esiste")
Else
Log("non esiste")
End If
End Sub
Sub RicercaBarCode(BarCode As String) As TyArt
If M.ContainsKey(BarCode) Then
Return M.Get(BarCode)
Else
Return Null
End If
End Sub