Help with VB6 -> B4A conversion!

Beja

Expert
Licensed User
Longtime User
Hello friends,
I used to use this code since a long time in VB6.0 for sending byte array to a microcontroller, now I am wondering how to port it to B4A.
Any help appreciated and thanks in advance!

DIM sendit(1 to 3) AS Byte
sendit(1) = "&H" & Text1.Text
sendit(2) = "&H" & Text2.Text
sendit(3) = "&H" & Text3.Text
MSComm1.Output = sendit
 

klaus

Expert
Licensed User
Longtime User
B4A admits only 0 as the first index.
So you have two solutions:
B4X:
DIM sendit(3) AS Byte
sendit(0) = "&H" & Text1.Text
sendit(1) = "&H" & Text2.Text
sendit(2) = "&H" & Text3.Text
or, but you loose the first item.
B4X:
DIM sendit(4) AS Byte
sendit(1) = "&H" & Text1.Text
sendit(2) = "&H" & Text2.Text
sendit(3) = "&H" & Text3.Text
Best regards.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thank you Klaus,
does that mean the code syntax of both lanuages is the same, except the start element?

vb6
sendit(x) = "&H" & Text3.Text

b4a
sendit(x) = "&H" & Text3.Text
 
Upvote 0
Top