Hi everyone,
What is the equivalent of VB6 CByte() function in B4A?
I'm trying to convert these vb.net code to B4A. My mind was very confused.
Thanks
What is the equivalent of VB6 CByte() function in B4A?
I'm trying to convert these vb.net code to B4A. My mind was very confused.
B4X:
Public Overridable Sub SetDateTime(ByVal dateTime As DateTime)
Dim year As Integer = dateTime.Year
Dim month As Integer = dateTime.Month
Dim day As Integer = dateTime.Day
Dim hour As Integer = dateTime.Hour
Dim minute As Integer = dateTime.Minute
Dim txCmdWithoutLastByteCheckSum As Byte() = New Byte() { &H51, &H33, CByte((((month And 7) << 5) + day)), CByte((((year - &H7D0) << 1) + (month >> 3))), CByte(minute), CByte(hour), &HA3 }
Me.connection.SendAndReceive(txCmdWithoutLastByteCheckSum, 8)
End Sub
B4X:
Public Shared Function CalcOneByteCheckSum(ByVal cmd As Byte(), ByVal startIndex As Integer, ByVal endIndex As Integer) As Byte
Dim num As Integer = 0
Dim i As Integer = startIndex
Do While (i <= endIndex)
num = (num + cmd(i))
i += 1
Loop
Return CByte((num And &HFF))
End Function
Thanks