Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 20th, 2007, 05:31 AM
Registered User
Join Date: Feb 2007
Location: waregem, , Belgium.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert 4 bytes to bit array

For some project tame and data are stored in 4 bytes where the first 6 bits are the seconds, next 6 are the minutes and so on. So if i could isolate each byte in an array , maybe than i can convert the first 6 bits to a byte and get it to figures. But i don't find a way how to do this. Could anyone help ?

  #2 (permalink)  
Old March 21st, 2007, 05:40 PM
Authorized User
Join Date: Dec 2006
Location: Fort Collins, Colorado, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to maxl

Hey Vinny_68

I was interested in your problem and figured out how to do perform some of the functionality. If you want to convert your Byte array (assuming its already an Byte array) to an array of Bits, use this statement:

Dim mybits() as new System.Collections.BitArray(your_byte_array)

After this, converting some of these Bits to a specific data type im not really sure how to do yet. There is a class; System.BitConverter that will convert a batch of bits to various data types. All the methods i saw in there only accept a minimum of 16 bits for the conversion to the smallest data type. Im sure there is a way to get this done though. I will post more info once i learn more.

Also, you might have to pad your 6 bits with dummy data for some conversion methods, or those might do that for you. Im not a expert in this area at all, im just speculating.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert arraylist into array mohitbhutani C# 2 June 14th, 2011 04:00 AM
hw to convert string to array asfakahmed Java Basics 1 May 11th, 2008 06:39 AM
64 Bit - Issue in 64 bit IIS calling Win32 API Hubman General .NET 1 August 24th, 2006 09:19 AM
convert bytes[] into base64binary in asp.net bharat_agarwal XSLT 1 June 20th, 2006 02:04 AM
Bytes doa-wnloaded vincentvdm Classic ASP Professional 0 August 17th, 2003 01:52 PM

All times are GMT -4. The time now is 02:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.