Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
But i can't convert StrPtr Function of VB-6.0 to VB.Net Or C#..
How can i solve this???
Please supply to right code..
Posted

Check the following link

StrPtr Equivalent in VB.NET
 
Share this answer
 
Comments
Ankur\m/ 26-Sep-11 8:19am    
That should help. 5!
insure msvbvm60.dll is installed and Try This
Private Declare Function VarPtr Lib "msvbvm60.dll" Alias "VarPtr" (ByVal lpObject As String) As Integer

Function StrPtr(ByVal x As String) As Integer
    Return VarPtr(x)
End Function

Or see:
http://www.codeproject.com/KB/vb/Marshal.aspx


it explain code like:
VB.NET
' dim managed variable

Dim MyString As String = "Adnan Samuel"
 ' pin variable and create

' GC handle instance

Dim gh As GCHandle = GCHandle.Alloc (MyString, GCHandleType.Pinned)
 ' get address of variable

Dim AddrOfMyString As IntPtr = gh.AddrOfPinnedObject()
 Console.WriteLine (AddrOfMyString.ToString())
 ' free the handle and unpin variable

gh.Free()

 
Share this answer
 
v4
Comments
Mehdi Gholam 26-Sep-11 8:28am    
Have you used this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900