Beginning VB 6For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning VB 6 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 .
The usual way to set the nth bit is just to 'Or' the current value with 2^(n-1), but VB's 16-bit integers are signed so the hi-bit (16th bit) denotes the sign. The easiest way to change the sign of an Int is to * -1.