hi,
i am converting a hex value to its binary equivalent,using the below function
here i am facing one problem,
i am converting a hex value ex.:0A8 it binary equivalent is 10101000
but i want the output as 000010101000.
i want all twelve bits to get displayed.
ex.:050
i want the above value as 000001010000
kindly provide me the solution
the function i have used to convert from hex to binary
Function HexStringToBinary(ByVal hexString As String) As String
Dim num As Integer = Integer.Parse(hexString, Globalization.NumberStyles.HexNumber)
Return Convert.ToString(num, 2)
End Function
as i am counting the number of bits,i need all bits
Thanks in advance
What I have tried:
i am converting a hex value to its binary equivalent,using the below function
here i am facing one problem,
i am converting a hex value ex.:0A8 it binary equivalent is 10101000
but i want the output as 000010101000.
i want all twelve bits to get displayed.
ex.:050
i want the above value as 000001010000
kindly provide me the solution
the function i have used to convert from hex to binary
Function HexStringToBinary(ByVal hexString As String) As String
Dim num As Integer = Integer.Parse(hexString, Globalization.NumberStyles.HexNumber)
Return Convert.ToString(num, 2)
End Function
Thanks in advance