C# to VB

  • Thread starter Thread starter Glenn Wilson
  • Start date Start date
G

Glenn Wilson

Hi,

I am using MSDN examples to help write a component using
VB.NET. The sample code is written in C# which, on the
whole is not giving me too difficulties when translating
to VB. However, there are a couple of code snippets I
don't quite know how to translate into VB. These are:

static private IntPtr NullPtr = ((IntPtr)((int)(0)));

and any instances where integer (int) values are initiated
with values such as 0x00000100, 0x00000200 etc or 0x1, 0x4.

Could anyone tell me what the VB equivalent is?

Thanks

Glenn
 
Hi,

I am using MSDN examples to help write a component using
VB.NET. The sample code is written in C# which, on the
whole is not giving me too difficulties when translating
to VB. However, there are a couple of code snippets I
don't quite know how to translate into VB. These are:

static private IntPtr NullPtr = ((IntPtr)((int)(0)));

Private Shared NullPtr As New IntPtr(0)
and any instances where integer (int) values are initiated
with values such as 0x00000100, 0x00000200 etc or 0x1, 0x4.

Replace the 0x with &H..

0x00000100 = &H100
0x00000200 = &H200
0x1 = &H1
0x4 = &H4

You can put the leading zero's but the IDE will remove them :)
Could anyone tell me what the VB equivalent is?

Thanks

Glenn

HTH
 
* "Glenn Wilson said:
I am using MSDN examples to help write a component using
VB.NET. The sample code is written in C# which, on the
whole is not giving me too difficulties when translating
to VB. However, there are a couple of code snippets I
don't quite know how to translate into VB. These are:

static private IntPtr NullPtr = ((IntPtr)((int)(0)));

Maybe you are looking for something like this:

\\\
Private ReadOnly NullPtr As IntPtr = IntPtr.Zero
///
and any instances where integer (int) values are initiated
with values such as 0x00000100, 0x00000200 etc or 0x1, 0x4.

Could anyone tell me what the VB equivalent is?

'&H1', '&H2', '&H4', ...
 
Back
Top