Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hex-Value in Visual Basic

Can someone just help me refresh my mind?

How do you specify hex values in a Visual Basic 6 / VBScript Source?

It's not 0xABCD as it is in C++, that's what I can remember... It was something similar... But what?

like image 297
BlaM Avatar asked Jan 09 '09 16:01

BlaM


People also ask

What is hex value of A?

Hexadecimal uses the decimal numbers and six extra symbols. There are no numerical symbols that represent values greater than nine, so letters taken from the English alphabet are used, specifically A, B, C, D, E and F. Hexadecimal A = decimal 10, and hexadecimal F = decimal 15.

How are hex values calculated?

Now, to calculate the hexadecimal number, there are three quick steps (as also stated above): Multiply the first number (or converted number from the letter) by 16. Multiply the second number (or converted number from the letter) by 1. Add those two totals together to get a single value.

What data type is a hex?

Hexadecimal is a numbering system with base 16. It can be used to represent large numbers with fewer digits. In this system there are 16 symbols or possible digit values from 0 to 9, followed by six alphabetic characters -- A, B, C, D, E and F.

How are hex values stored?

For example, the value 97, in hex might be 61. This is a two digit number, containing character "6" followed by "1". Encoded as ASCII that would be two bytes: the value 54 followed by the value 49 (decimal).


2 Answers

Try &HABCD, that's how it works for most BASIC languages.

like image 134
schnaader Avatar answered Sep 26 '22 02:09

schnaader


VBScript \ VBA \ VB6 (and lower):

Dim MyValue As Integer MyValue = &h1234 

VB (.NET Framework):

Dim MyValue As Integer = &h1234 

Versions are usually backwards compatible syntax-wise, you cannot always use newer syntax in older versions.

like image 43
BobTheBuilder Avatar answered Sep 25 '22 02:09

BobTheBuilder