Dim x As IntPtr
Dim y As Integer = 123
x = New IntPtr(y)
EDIT ==============
Since the method you're calling (
Marshal.Copy
) takes an
IntPtr
, you shouldn't be making the calculation result a
long
to begin with.
Dim value as Integer = bmpDat1.Scan0 + tmpBmp.Width * i
Marshal.Copy(byteArray, tmpBmp.Width * (tmpBmp.Height - 1 - i), new IntPtr(value), tmpBmp.Width)