Help with Converting Qword To Byte...
This question is also posted in the vb.net forum(I did not know there was a math forum at the time of posting)
I am new to VB.Net (about 3weeks into learning) and I decided to create a Scientific Calculator as a learning project(similar to the calc in windows). I have the program performing basic function such as: Addition, Subtraction etc. I now am trying to complete the base convergence(from base10 -base2 etc.). Right now I can convert a number to and from either base but my problem is converting the word size(Qword - Dword - Word - Byte). As in the windows calc, If you typed a binary number with "Qword" set and then selected "Byte" it will convert the (64bit) number to a (8bit) number. My question is, does any one know how this is done? Even if someone could just explain it mathmatically I can apply it to what I have learned so far. Here is an example:
In windows calc
enter base10: 2500
switch to binary(Qword Set): 100111000100
Still in Binary, switch (Qword to Byte): 11000100
Now I get the proper binary number (from base10 - base2) but going from Qword to Byte is the problem.
The code I have for converting base10 to base2 is:
Public Function DTB(ByVal Dec As String) As String
Dim ct As Integer
Dim tn, rtn As String
Dim n As Long
ct = Dec.IndexOf(".")
If ct > 0 Then
tn = Dec.Substring(0, ct)
n = tn
Else
n = Dec
End If
rtn = Trim(Str(n Mod 2))
n = n \ 2
Do While n <> 0
rtn = Trim(Str(n Mod 2)) & rtn
n = n \ 2
Loop
keyData = rtn
End Function
If someone can help me with this I would greatly appreciate it!
Re: Help with Converting Qword To Byte...
it looks like BYTE = QWORD and &HFF