from programming vb6.0 - converts binary to dec
then hex$(bintodec return value)

Private Sub Command1_Click()
Text2.Text = binToDec(Text1.Text)
End Sub

Public Function binToDec(value As String) As Long
Dim result As Long, i As Integer, exponent As Integer

For i = Len(value) To 1 Step -1
Select Case Asc(Mid$(value, i, 1))
Case 48
Case 49
result = result + power2(exponent)
Case Else
Err.Raise 5
End Select
exponent = exponent + 1
Next
binToDec = result

End Function

Public Function power2(ByVal exponent As Long) As Long
Static result(0 To 31) As Long, i As Integer
If result(0) = 0 Then
result(0) = 1
For i = 1 To 30
result(i) = result(i - 1) * 2
Next
result(31) = &H80000000
End If
power2 = result(exponent)
End Function

hope it helps...
oh and in case you need it - DecToBin

Public Function decToBin(ByVal value As Long) As String
Dim result As String, exponent As Integer
result = String(32, "0")
Do
If value And power2(exponent) Then
'bit is set - clear it
Mid$(result, 32 - exponent, 1) = "1"
value = value Xor power2(exponent)
End If
exponent = exponent + 1
Loop While value

result = Mid$(result, 33 - exponent)
decToBin = result
End Function

Edited by _bman_ on 03-11-2000 at 11:18 AM