Sorry.. but what's Denary?
Do you mean Decimal? (with to-the-powers with 10?)
In that case, Yonatan got a short way to do that:
and I made a longer oneCode:Function Bin(ByVal lNum As Long) As String Do Bin = Chr(48 + (lNum And 1)) & Bin lNum = lNum \ 2 Loop Until lNum = 0 End Function
Have funnnCode:Private Function MakeBin() Static bin As String, asc As Long bin = "" asc = Val(Text1.Text) Do 'If 0 Then Exit the loop If asc = 0 Then Exit Do 'Check if even If asc Mod 2 = 0 Then 'If even then add 0 to the binair number bin = "0" & bin 'and divide ascii by 2 asc = asc / 2 Else 'If odd then add 1 to the binair number bin = "1" & bin 'Subtract 1 and divide by 2 asc = (asc - 1) / 2 End If Loop MakeBin = bin End Function
[Edited by Jop on 11-08-2000 at 11:44 AM]





Reply With Quote