Converting BitArray to Int and Int to BitArray 
Author Message
 Converting BitArray to Int and Int to BitArray

Converting BitArray to Int and Int to BitArray

Can anyone help?

Thanks
J.F. Larente
United Way/Centraide Ottawa



Sun, 03 Jul 2005 04:06:32 GMT  
 Converting BitArray to Int and Int to BitArray
Jean-Fran?ois,

Quote:
>Converting BitArray to Int

Dim i(0) As Integer
YourBitArray.CopyTo(i, 0)

Adjust the array size to be large enough to have room for the BitArray
bits.

Quote:
>and Int to BitArray

YourBitArray = New BitArray(New Integer() {YourInt})

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Sun, 03 Jul 2005 04:44:53 GMT  
 Converting BitArray to Int and Int to BitArray
Thank you...
It's starting to make sense to me.

Now, I'll tell you the point of my excercise so that you can maybe further
help me.
Maybe I'm in left field with this method.

I have 16 departments which are assigned to a position in a 16 bit binary
string.
I have a read and a write field

So, if all 16 departments are allowed to read, the 16 bits would all be set
to true.

If department 15 ONLY was allowed to write, the second-last bit would be set
to true (a value of int 2)

Anyway, I have a hard time explaning what I want...

I store an int in the DB and use a 16 bit int to verify access rights.

Thanks if you understand!

J.F.


Quote:
> Jean-Fran?ois,

> >Converting BitArray to Int

> Dim i(0) As Integer
> YourBitArray.CopyTo(i, 0)

> Adjust the array size to be large enough to have room for the BitArray
> bits.

> >and Int to BitArray

> YourBitArray = New BitArray(New Integer() {YourInt})

> Mattias

> ===

> http://www.msjogren.net/dotnet/
> Please reply only to the newsgroup.



Sun, 03 Jul 2005 05:21:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Converting ULONG (4 byte binary) int VB Long / SQL INT for DTS Import

2. Convert Int to Str & Str to Int

3. How to display int, short int range values

4. Int to Str or Str to Int ??

5. int main( int argc, char *argv[]) in VB??

6. Error with BitArray.CopyTo

7. Does anyone know how to use new Bitmap(int,int,int,PixelFormat, IntPtr) ?

8. how to convert INT type to UINT16 type?

9. How to convert string to double or int

10. converting int to string

11. Converting ULONG binary in SQL Server INT (esp in DTS)

12. converting a string to an int

 

 
Powered by phpBB® Forum Software