I would like the experts to help me about the code ,I have VB6.0 code is
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
 and 
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I would like to use in B4A ,I don't know how to code these line as belows
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I have coded function CRC() is belows
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			
			
				B4X:
			
		
		
		Function CRC16A(buffer() As Byte) As Long
Dim i As Long
Dim Temp As Long
Dim crc As Long
Dim j As Integer
    crc = &HFFFF&
    For i = LBound(buffer) To UBound(buffer)
        Temp = buffer(i) * &H100&
        crc = crc Xor Temp
           
           For j = 0 To 7
                If (crc And &H8000&) Then
                    crc = ((crc * 2) Xor &H1021&) And &HFFFF&
                Else
                    crc = (crc * 2) And &HFFFF&
                End If
            Next j
Next i
CRC16A = crc And &HFFFF
    
End Function
	
			
				B4X:
			
		
		
		...
...
Dim m As String
m = IIf(Val(Text5.Text) = 0, QRCodePromptPayPart1 & QRCodePromptPayPart3, QRCodePromptPayPart1 & QRCodePromptPayPart2 & QRCodePromptPayPart3)
Dim aBuf() As Byte
    
    Dim crc As Long
    
    aBuf = StrConv(m, vbFromUnicode)
    
     crc = CRC16A(aBuf)
    
    
    QRCodePromptPayIs = m & Hex(crc)
...
...
	
			
				B4X:
			
		
		
		    aBuf = StrConv(m, vbFromUnicode)
	
			
				B4X:
			
		
		
		  QRCodePromptPayIs = m & Hex(crc)
	I have coded function CRC() is belows
			
				B4X:
			
		
		
		Private Sub CRC16A(Buffer() As Byte) As Long
Dim i As Long
Dim Temp As Long
Dim crc As Long
Dim j As Int
    crc = 0xHFFFF
    'For i = LBound(Buffer) To UBound(Buffer)
    For i = 0 To Buffer.Length - 1
        Temp = Buffer(i) * 0xH100
        'crc = crc Bit.Xor Temp
        crc = Bit.Xor (crc ,Temp)
           
           For j = 0 To 7
                'If (crc Bit.And 0xH8000) Then
            If  Bit.And(crc, 0xH8000) Then
                   ' crc = ((crc * 2) Bit.Xor 0xH1021) And 0xHFFFF
                crc = Bit.And( Bit.Xor((crc * 2), 0xH1021), 0xHFFFF)
                Else
                    'crc = (crc * 2) Bit.And 0xHFFFF
                crc =  Bit.And( (crc * 2), 0xHFFFF)
                End If
           Next 
   Next 
    Return  Bit.And( crc,0xHFFFF)
End Sub