Hi
I have a text box where I enter time in seconds (can be decimal values up to 3 decimals) and I have to store it as Float.
I make some math and store it as 2 bytes (4 and 5) in a byte array.
Here is the code:
Sub btnTimeSet_Click
Dim BC As ByteConverter
Dim Ftime As Float
Dim Stime As Short
Dim conf(256) as Byte
Ftime = Round2(etTime.Text,3)
Ftime = (Ftime + 0.012)*40
Stime = Floor(Ftime)
Dim gxx() As Byte = BC.ShortsToBytes(Array As Short(Stime))
conf(4) = gxx(1)
conf(5) = gxx(0)
End Sub
Later in App I need to retrieve the original time value written in a textbox again as a same decimal number, so I need to convert conf(4) and conf(5) back to one Short and then to Float and write it as decimal in another textbox.
Can someone please help because I tried with BC.ShortsToBytes and BC.FloatsToBytes but I either get negative values (short) or Out of bounds exception for Float