Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

VS 2010 [RESOLVED] Integer cannot be converted to UShort

$
0
0
I have this piece of code in C#:
vb.net Code:
  1. return ((UInt16)(((0xFF00 & input) >> 8) | ((0x00FF & input) << 8)));

Here is the VB code:
vb.net Code:
  1. Return DirectCast(((&HFF00 And input) >> 8) Or ((&H00FF And input) << 8), UInt16)

But the VB code is throwing the following error:
Quote:

Value of type 'Integer' cannot be converted to 'UShort'.
Any ideas why I am getting it ? I was stumped because the C# code is not throwing that error!

Thanks in advance :wave:

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>