Convert integer to intptr

stustarz

Well-known member
Joined
Jan 10, 2003
Messages
246
Location
Earth
Hi

In c# i can use:

Code:
ListViewAPI.CDRF_DODEFAULT is an integer value
(IntPtr)ListViewAPI.CDRF_DODEFAULT

To convert an integer to type intptr, so how can i do it in VB, ive tried:

Code:
CType(ListViewAPI.CDRF_DODEFAULT,intptr)

But recieve an error stating i cant convert an integer to intptr.

Also.....

this in c#:

Code:
(nmcd.hdr.hwndFrom != Handle)

doesnt work when translated to vb, it states that the operator <> is not defined for types intptr to intptr!

Any c# and vb gurus who can help me out here?

Cheers
 
Last edited by a moderator:
Sorry im not looking to know how to declare variables in c#

I am looking to convert c# into vb - in particular converting integers to intptrs and comparing two values of type intptr using the <> (vb syntax). Neither of these seem to work in VB yet are fine in c#
 
I cheated and use roeders decompiler to decomiple my code to vb.net
[VB]
<STAThread> _
Private Shared Sub Main(ByVal args As String())
Dim ptr1 As IntPtr
Dim ptr2 As IntPtr
Dim num1 As Integer = 3
Dim num2 As Integer = 6
ptr1 = New IntPtr(num1)
ptr2 = New IntPtr(num2)
Dim flag1 As Boolean = (ptr1.ToInt64 < ptr2.ToInt64)
Console.WriteLine(flag1)
End Sub



[/VB]
 
thanks very much for the help, great idea about decompiling to vb, i convert c# to vb.net quite a bit, but can get a bit stuck when certain aspects of c# are completely different to the vb.net way!
 
Back
Top