In converting some functions from VB to PB......
On the nDec = nDec + ..... line I get the Error 420 Relational operator expected error message. If I run under VB it works fine. I have narrowed it down to be something to do with the MID$.
Any suggestions?
[This message has been edited by Shawn Tartaglia (edited April 19, 2000).]
Code:
FUNCTION Bin2Hex(BYVAL sBin AS STRING) AS STRING DIM i AS INTEGER DIM nDec AS LONG DIM sLEN as INTEGER sBin = STRING$(4 - sLEN MOD 4, "0") & sBin 'Add zero to complete Byte sLEN = LEN(sBin) FOR i = 1 TO sLEN nDec = nDec + CINT(MID$(sBin, (sLEN - i) + 1, 1)) * 2 ^ (i - 1) NEXT i Bin2Hex = HEX$(nDec) IF LEN(Bin2Hex) MOD 2 = 1 THEN Bin2Hex = "0" & Bin2Hex END FUNCTION
Any suggestions?
[This message has been edited by Shawn Tartaglia (edited April 19, 2000).]
Comment