|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Converting Base 2 Numbers to Base 10Is it possible to convert from a BitArray to its Base 10 counterpart?
So if you have Dim x As New BitArray(New Integer() {1, 0, 1}) Then how can you get to 5 from x being 101? Hello Phil,
Try this: Dim a(3) As Byte Dim x As New BitArray(New Boolean() {True, False, True}) x.CopyTo(a, 0) 'x.Length must be between 0 and 32. MsgBox(BitConverter.ToInt32(a, 0)) Regards. "Phil Galey" <paga***@starcalif.com.nospam> escribió en el mensaje news:eWG0hAISGHA.1844@TK2MSFTNGP12.phx.gbl... Is it possible to convert from a BitArray to its Base 10 counterpart?So if you have Dim x As New BitArray(New Integer() {1, 0, 1}) Then how can you get to 5 from x being 101? Great. Thank you.
"José Manuel Agüero" <chema012 en hotmail.com> wrote in message Try this:news:#CtAfaISGHA.1688@TK2MSFTNGP11.phx.gbl... Hello Phil, Dim a(3) As Byte Dim x As New BitArray(New Boolean() {True, False, True}) x.CopyTo(a, 0) 'x.Length must be between 0 and 32. MsgBox(BitConverter.ToInt32(a, 0)) Regards. "Phil Galey" <paga***@starcalif.com.nospam> escribió en el mensaje Is it possible to convert from a BitArray to its Base 10 counterpart?news:eWG0hAISGHA.1844@TK2MSFTNGP12.phx.gbl... So if you have Dim x As New BitArray(New Integer() {1, 0, 1}) Then how can you get to 5 from x being 101?
Should I Use "Dim ___ As New ___"?
exe/dll as scheduled task Icons in Application Menus VB.Net File.Copy Conundrum Access, OLE & VB.NET How To Cancel Edits on a control? Setting Foreground Color Property at Row Level in Datagrid How Many SQL Connections Should I Use? Tracking changes made to form... Printing Question |
|||||||||||||||||||||||