Hex-Value in Visual Basic

2019-02-16 06:39发布

问题:

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?

回答1:

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



回答2:

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.



回答3:

&H<hex-value> if my memory serves my correctly.

Like: &HABCD



回答4:

msgbox hex(255)