Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
Can you help me how to convert double value to hexa decimal values in vb.net...
my actual code is
VB
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Dim Val As Double
  Val=TextBox1.text

in this how we convert val(double) to hexa decimal...
please help me.....................
Posted
Updated 14-Nov-12 1:15am
v2

1 solution

 
Share this answer
 
v2
Comments
chandinig 15-Nov-12 2:05am    
thanks for response,
actually my number is 12.5 so how to convert this one to hexa decimal number
ridoy 15-Nov-12 11:44am    
i think those links will help you to convert it..
chandinig 16-Nov-12 4:07am    
sorry i didn't get can you give me simple vb code for hexa decimal value for 12.340............
please....................
ridoy 16-Nov-12 4:19am    
try with..
Dim D As Double = 12.340
Dim B() As Byte = BitConverter.GetBytes(D)
Dim SB As New System.Text.StringBuilder(B.Length)
For I As Integer = 0 To B.Length - 1
SB.Append(Hex(B(I)))
Next
Dim S As String = SB.ToString

or..

Dim D As Double = 12.340
Dim I64 As Int64 = BitConverter.DoubleToInt64Bits(D)
Dim S As String = Hex(I64)
chandinig 16-Nov-12 5:25am    
For first program i get AE47E17A14AE2840 but my exact need is for 12.340 i want get 70A44145 hexa decimal value...
please help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900