Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to test a single bit in Visual Basic?

Status
Not open for further replies.

neoaspilet11

Full Member level 5
Full Member level 5
Joined
Sep 29, 2005
Messages
277
Helped
29
Reputation
56
Reaction score
8
Trophy points
1,298
Location
Cebu, Philippines
Activity points
4,048
Hello Everybody,

Is there a simple way to access a single bit of a byte data type in VB?

Example: a = 90 = 0x5A

how to access bit 4 of a?

Thanks,

Jack
 

For Byte, Integer and Long datatypes the AND OR NOT operators apply as bit operators in VB.

a = &H01
b = &H02

a And b = &H00
a Or b = &H03

(a And b) = a -> False
(a And a) = a -> True

Then when it comes to the next part of bit manupulaiton, shifting, there is no simple way to do this. Devide and Multiply with powers of 2 works for bytes but when it comes to Integers and Longs then you get into problems with the sign bit and how that is used...

Real crap that they dont have a way of working with unsigned integer and long values and also a way to do shifting.

regards Me
 
Hello,
I think this is the possible solution.
Bye
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top