Board index » Visual Studio » Converting value to HEX
|
DudeX
|
|
DudeX
|
Converting value to HEX
Visual Studio282
I have a program that saves values in the following format: 4096,4095,4044,3900,3812,........... to a text file. I need to know how to convert the 4096 into a HEX value in this format: 0x40 + 0x96. This format require me to seperate the Hi bits and Lo bits. Can anyone help me out? - |
| AnandMVP
Registered User |
Fri Sep 07 08:50:05 PDT 2007
Re:Converting value to HEX
You can use the Hex function to convert decimal to Hex.
To seperate hi and lo byte, there are quite a few sample code on the net. I found the following: Public Function HiByte(ByVal wParam As Integer) HiByte = wParam \ &H100 And &HFF& End Function Public Function LoByte(ByVal wParam As Integer) LoByte = wParam And &HFF& End Function See if it helps -- Rgds, Anand VB.NET MVP www.dotnetindia.com">www.dotnetindia.com "cmdolcet69" wrote: QuoteI have a program that saves values in the following format: |
| cmdolcet69
Registered User |
Fri Sep 07 09:25:35 PDT 2007
Re:Converting value to HEX
On Sep 7, 11:50 am, Anand[MVP] <Anand...@discussions.microsoft.com>
wrote: QuoteYou can use the Hex function to convert decimal to Hex. - |
| guffa
Registered User |
Fri Sep 07 09:39:10 PDT 2007
Re:Converting value to HEX
cmdolcet69 wrote:
QuoteOn Sep 7, 11:50 am, Anand[MVP] <Anand...@discussions.microsoft.com> Here's another method: Dim bytes As Byte() = BitConverter.GetBytes(3900) bytes(0) contains low byte and bytes(1) contains high byte. -- Göran Andersson _____ www.guffa.com">www.guffa.com - |
| cmdolcet69
Registered User |
Sun Sep 09 07:36:30 PDT 2007
Re:Converting value to HEX
On Sep 7, 12:39 pm, G=F6ran Andersson <gu...@guffa.com>wrote:
Quotecmdolcet69 wrote: - |
| guffa
Registered User |
Sun Sep 09 14:49:49 PDT 2007
Re:Converting value to HEX
cmdolcet69 wrote:
QuoteOn Sep 7, 12:39 pm, Göran Andersson <gu...@guffa.com>wrote: Example: MyLabel.Text = bytes(0).ToString() -- Göran Andersson _____ www.guffa.com">www.guffa.com - |
