When declaring a sub can we do something like
This would reside in my u Code module
Somehwhere else I'd do something like
where they are local labels in an activity
I guess if not I'd have to do something like
Does anyone know about using ByRef or something similar?
regards, Ricky
B4X:
Sub SetFareCount(ByRef l1 as Label, ByRef l2 as Label)
'get some data from db
Dim cur As Cursor
cur = mySQL.ExecQuery("Select SomeField,CustomerID FROM Cust")
If cur.RowCount>0 Then
cur.Position=0 '1st record
l1.Text = cur.getString("SomeField")
l2.Text = cur.getInt("CustomerID")
End Sub
This would reside in my u Code module
Somehwhere else I'd do something like
B4X:
u.SetFareCount(lFirstLine,lSecondLine)
where they are local labels in an activity
I guess if not I'd have to do something like
B4X:
Type typeRecCount(Line1 As String, Line2 As String)
Dim myRecCount as typeRecCount
myRecCount = u.SetFareCount(DateTime.Now)
lRecCount1.Text = myRecCount.Line1
lrecCount2.Text = myrecCount.Line2
.
.
.
Sub SetFareCount(datein as Long) As myRecCount 'in u module
Dim ret as typeRecCount
typeRecCount.Initialize
'get stuff from db
ret.Line1 = cur.GetString("FareType")
ret.Line2 = cur.GetString("FareCount")
Return ret
End Sub
Does anyone know about using ByRef or something similar?
regards, Ricky