Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get ptr in VB.Net

Status
Not open for further replies.

Curtis360it

IS-IT--Management
Nov 7, 2005
88
US
I have some code that needs to get the pointer to an object. The code is asking for a "pFileTo" object. Anyone have a suggestion?
 
VB.Net is (imo) kinda "funky" on this point.

Say you do something like
Code:
Dim a, b as string
a = new string("stuff")
b=a
a="other stuff"

I have found instances where b now contains "other stuff", which leads me to want to think that there is some "pointer-ism" stuff going on. These have been in loop situations where i usually miss a "Dim b as New String"

Can you give a better definition, or show some code, to explain what you are trying to do?

-The answer to your problem may not be the answer to your question.
 
Basically the code is something like:

FileTo.Invoke(<hwndwindow as integer>,<pFileTo as object>)

 
IF you are trying to use C type pointers, vb.net does NOT support C type pointers. You might want to do a google search for vb net pointers to find more help.
 
Yea,I was hoping there was a crossover I could use. Thanks for the help!
 
can you see what the .FileTo function does?

You may be able just pass whatever the pFileTo as a ByRef instead of ByVal.

-The answer to your problem may not be the answer to your question.
 
Curtis360it,

Try looking at System.IntPtr structure in .NET documentation.

It is a platform-specific type that is used to represent a pointer or a handle in .NET. The IntPtr type is designed to be an integer whose size is platform-specific. That is, an instance of this type is expected to be 32-bits on 32-bit hardware and operating systems, and 64-bits on 64-bit hardware and operating systems.

The IntPtr type can be used by languages that support pointers, and as a common means of referring to data between languages that do and do not support pointers.

IntPtr objects can also be used to hold handles. For example, instances of IntPtr are used extensively in the System.IO.FileStream class to hold file handles.

Hope it helps you and solves your problem.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top