C# to VB

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
 
T

Tom Shelton

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
 
H

Herfried K. Wagner [MVP]

* "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', ...
 

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