|
-
Jan 31st, 2004, 06:01 AM
#1
Thread Starter
Frenzied Member
Bitwise Operations ???
VB Code:
Dim decValue as Decimal = cDec(2^3+2^4+2^2+2^0)
If DecValue = (decValue And 2^4) Then
'Fifth bit set
Msgbox "Bit 5 is set"
End if
This gives me a conversion error with Option Strict On
Do bitwise operators only work with Longs??
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Jan 31st, 2004, 06:41 AM
#2
Hi.
If DecValue = (decValue And 2^4) Then
This is just a guess. I have not tried this, but I think That should propably be If DecValue = (decValue And cDec(2^4)) Then
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 2nd, 2004, 04:51 AM
#3
What is it that you're trying to do? It's very unusual to be doing bitwise operations on decimals. If you think about the way that decimals are stored in memory you'll see what I mean. Using the correct casting you should be able to get rid of your Option Strict errors, but I'm still not sure that your code is going to make a lot of sense.
This world is not my home. I'm just passing through.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|