C# to VB

O

OpticTygre

Converting some code from C# to VB

C#:
public const int LOCSIG = 'P' | ('K' << 8) | (3 << 16) | (4 << 24);

Here's what I have in VB:
Public Const LOCSIG As Integer = "P"c Or ("K"c << 8) Or (3 << 16) Or (4 <<
24)

Problem is, I get an error stating that '<<' is not defined for types 'Char'
and 'Integer' on the ("K"c << 8). It works in C#, but why not in VB?
 
G

Guest

Operator << is for integers, so cast characters to integer, like this:

Public Const LOCSIG As Integer = AscW("P") Or (AscW("K") << 8) Or (3 << 16)
Or (4 << 24)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top